This is a mobile news app built using Swift and UIKit that integrates the New York Times API. The app allows users to browse breaking news, explore recommendations, save news, and search for articles with an intuitive and elegant user interface.
Home Screen
- Breaking News section with horizontally scrollable cards
- Recommendations section with vertically scrollable articles
Search Page
- Discover categories (e.g. Arts, Science, Sports)
- Live search functionality for keywords
- Displays results based on both categories and text input
Article Details
- View detailed news content
- Save articles for offline reading
Saved Articles
- Dedicated page showing all saved articles
- Option to unsave articles
- Swift: Core language for development
- UIKit: UI framework for creating views and layout
- CoreData: Used to persist saved articles
- SDWebImage: For efficient asynchronous image loading
- MVVM Architecture: Organizes code for maintainability
- New York Times API: Fetches article data (Top stories api and Article search api)
- Auto Layout: Ensures responsive UI on all device sizes
- Clone this repository:
git clone https://github.com/your-username/NYT-News.git cd NYT-News - Open the project in Xcode.
- Install dependencies if not already present (e.g. SDWebImage)
- Add your API key:
- Create a Config.plist file
- Add a key: NYT_API_KEY and paste your New York Times API key as its value
- Run the app on a simulator or physical device
- Visit NYT Developer Portal
- Create an account and generate an API Key
- Add the key to Config.plist under the key NYT_API_KEY
- Implement bookmarking animations
- Add dark mode support
- Improve search suggestions and filters
- Localization for multiple languages
- Add live stock market information to the home page
- Create a User Login
The app utilizes two different endpoints from the New York Times API:
- Top Stories API: for breaking news and category-based highlights
- Article Search API: for fetching detailed results based on user queries
Improved Error Handling
- Graceful fallback for empty states and API failures
- User-friendly error messages shown when no results are found
Secure API Key Management
- API keys are stored securely in Config.plist (excluded from version control)
- The app reads keys safely using a ConfigManager, preventing hardcoded secrets
Model Compatibility
- Data models conform to Codable, allowing smooth decoding of JSON responses
- Custom keys mapped using CodingKeys for precise control over JSON parsing
Efficient Networking
- URLSession-based APIService manages requests in a centralized and reusable way
- Async/await support for clean and modern asynchronous handling
Scalability Consideration
- Modular structure allows for easy addition of new NYT endpoints or APIs
- Error and success states are handled via enums to simplify response logic