Skip to content

This project is a simple example of using Swift with MVVM and Clean architecture for news related app.

Notifications You must be signed in to change notification settings

DixPatel009/NewsApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 

Repository files navigation

NewsApp - Swift - MVVM - Clean Architecture

This project is a simple example of using Swift with MVVM and Clean architecture for news related app.

Features

  • Login using an API key (News.org)
  • Fetch and display a list of news articles from the API (News.org)
  • Implement search, date selection, and sort by filters
  • Allow switching between grid and list layouts for the article list
  • Enable users to swipe to add/remove favorites for articles using core data (Favourite Screen with UITableView and Search Screen with UICollectionView)
  • Display a badge on the tab bar indicating the number of favorite articles (Using userdefualts)
  • Show a detailed view for each selected article (Open URL and Share Article Functionality)
  • Provide an option to change the API key
  • Allow users to log out of the app

Screenshot

splace login Search Searchwithgrid favourite Setting Changekey

Requirements

  • iOS 15.0+
  • Xcode 15.0+
  • Swift 5.0+

Installation

  1. Clone the repository:

  2. Open the project in Xcode:

    • open News.xcworkspace
  3. Build and run the project on your preferred simulator or device.

Architecture

The project follows the MVVM & Clean architecture pattern:

  • Model: Holds the data
  • View: Views that display the data.
  • ViewModel: Manages the data for a view by interacting with the model and preparing the data for presentation in the view.
  • Repository: Responsible for interacting with the data.
  • ViewController: Manages the UIKit view and binds to ViewModel
  • Manager: Manage a functionality based on features
  • Constants: Holds the variables whose values can't be changed
  • Extension: Allow you to extend an existing class, struct, enumeration, or protocol with new functionality

Project Structure

News/
├── AppDelegate.swift  # Entry point of the app
├── Models/
├── ViewControllers/
├── ViewModels/
├── Views/
├── Repository/
├── Managers/
├── Extension/
├── Constants/
├── Utilities/
├── News.xcdatamodeld //Coredata 

Acknowledgements

  • Swift Documentation
  • MVVM Architecture Patterns
  • Clean Architecture
  • Solid Principal

Contact