Swift-MVP-Sample
Swift-MVP-Sample copied to clipboard
It's an iOS simple project that how I implement MVP (Model-View-Presenter) and Clean Architecture in Swift.
trafficstars
Swift-MVP-Sample
It's an iOS simple project that how I implement MVP (Model-View-Presenter) and Clean Architecture in Swift.
Requirements
- Xcode 10.2+
- Swift 5.0+
Architecture

View Layer (MVP)
View- Displays information from thePresenterand sends user interactions back to thePresenter.Presenter- Contains the presentation logic and tells theViewwhat to presentViewBuilder- TheBuilder’sresponsibility is to instantiate a specificViewand injects the dependency for all components.Router- Handles navigation logic for which screen should appear and when.
Domain Layer
UseCase- Contains the business logic for a specific use case in the project. They are view agnostic and can be consumed by one or manyPresenters.Model- Simple data model objects.
Data Layer
Repository- Query objects from different data sources (Core Data, Realm, web server, etc.) with a only single-entry point.
References
- iOS: MVP clean architecture in Tiendeo app
- Library - iOS - MVP + Clean Architecture Demo
- The Clean Architecture, by Uncle Bob
- Test Double
Author
Nixon Shih, [email protected]
License
Swift-MVP-Sample is available under the MIT license. See the LICENSE file for more info.