A SwiftUI app to explore the most popular articles using the New York Times API.
$ git clone https://github.com/mahi8514/trending-articles.git
- Visit the New York Times Developer Portal.
- Create an API key and ensure the "Most Popular" feature is enabled.
-
Open the
trending_articlesApp
file and locate theinit
method. -
Add the following code:
ArticleStoreImpl.activate(baseUrl: "base-url", apiKey: "your-api-key")
-
Replace:
base-url
withapi.nytimes.com
your-api-key
with the key generated in the previous step.
💡 Pro Tip: For enhanced security, store the API key in config.xcconfig
instead of hardcoding it to avoid exposing sensitive information in version control.
- Open the project in Xcode.
- Select a simulator or connect your device.
- Click Run to start the app!
- Open the Test Navigator in Xcode.
- Click the Run button next to 'test-articlesTest' to run all 17 tests.
- You can also:
- Run tests for a specific file.
- Run tests individually if needed.
- Open Xcode's Reports Navigator after running the full suite tests.
- Select the latest run and click Coverage for detailed insights.
Alternatively:
- Locate the test report file:
DerivedData/your_project_name/Logs/Test/{test_file}.xcresult
- Double-click the
.xcresult
file to view the report directly in Xcode.