This repository contains a detailed sample app that implements VIPER architecture using
- Alamofire: https://github.com/Alamofire/Alamofire
- PromiseKit: https://github.com/mxcl/PromiseKit
- R.swift: https://github.com/mac-cain13/R.swift
In order to perform its mission module, it is necessary to solve several problems. It is required to implement the business logic module, networking, database, render the user interface. VIPER describes the role of each component and how they interact with each other.
The View layer is responsible for displaying the user interface and capturing user input. It should not contain business logic. Instead, it delegates user actions to the Presenter for processing.
The Interactor layer contains the business logic and is responsible for interacting with the data layer. It receives requests from the Presenter, processes them, and returns the results.
The Presenter acts as a mediator between the View and the Interactor. It receives user input from the View, processes it, and updates the View accordingly. The Presenter also communicates with the Interactor to fetch or manipulate data.
The Entity layer represents the data models used in the application. It encapsulates the data and business logic related to the application's domain.
The Router handles navigation and routing logic. It is responsible for transitioning between different screens or modules within the application.
- Modules should be named according to functionality.
- Example:
LoginView
,UserProfileInteractor
.
- Example:
- Inject dependencies during initialization.
- Avoid components creating their own dependencies.
- Each component should have a single responsibility.
- Keep components focused on specific tasks.
- Use protocols to define interfaces.
- Promotes loose coupling and easy testing.
Checkout 👉 Code Conventions | Development and Release process
- iOS 15.0+
- Xcode 13
- Swift 5
git clone https://github.com/blink22/Code-Sample-iOS.git
cd Code-Sample-iOS
pod install
open Code-Sample-iOS.xcworkspace
- Straight to the point: VIPER architectural pattern
- VIPER Architecture for iOS App Development
- Understanding and implementing VIPER architecture for iOS applications
- Make sure to test your code (Don't depend on having a QA or PR reviewers to find the bugs)
- DON'T make any changes on production before communicating with your manager/senior