Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shutdownr/viper-ios
Implementation of the VIPER pattern with an iOS application
https://github.com/shutdownr/viper-ios
Last synced: about 2 months ago
JSON representation
Implementation of the VIPER pattern with an iOS application
- Host: GitHub
- URL: https://github.com/shutdownr/viper-ios
- Owner: shutdownr
- License: mit
- Created: 2019-07-21T12:08:50.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-07-23T13:46:16.000Z (over 5 years ago)
- Last Synced: 2024-05-29T03:21:48.040Z (8 months ago)
- Language: Swift
- Size: 118 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# viper-ios
Implementation of the VIPER pattern with a tic-tac-toe iOS application.![VIPER pattern](https://github.com/shutdownr/viper-ios/blob/master/Pattern.png)
The VIPER pattern is a more specific implementation of the MVP pattern. It is often used as an alternative to MVC.
### Flow of events in VIPER
1. The user clicks on a button in the View.
2. The View receives the IBAction, forwards the call to the Presenter.
3. The Presenter knows what to do after the callback and triggers an update function in the Interactor.
4. The Interactor uses and updates the Entity, that saves the relevant application data. (The update can be asynchronous, with CoreData, ...)
5. After the update is done, the Interactor forwards the new data to the Presenter.
6. The Presenter receives the data and transforms it into View-relevant data. (E.g. Strings for texts, Bool for visibilities, ...)
7. The Presenter sends the formatted data to the View.
8. The View receives the new data and updates correspondingly.### Role of the router
* Used for navigation between different Views
* Called by the presenter to perform segues whenever needed
* Creates all VIPER classes and references between them, when a new View is created### Communication between the components
* Protocols are used for every communication step
* E.g. the Presenter contains three communication protocols, to the View, to the Router and to the Interactor
* The router establishes the connections between every class when creating the objects.