Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zalazara/swiftui-viper-xcode-templates
This template generates all files that you need to create a new VIPER module in SwiftUI.
https://github.com/zalazara/swiftui-viper-xcode-templates
ios open-source swift swiftui template xcode
Last synced: 23 days ago
JSON representation
This template generates all files that you need to create a new VIPER module in SwiftUI.
- Host: GitHub
- URL: https://github.com/zalazara/swiftui-viper-xcode-templates
- Owner: zalazara
- Created: 2022-11-10T13:22:23.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-10T13:44:51.000Z (about 2 years ago)
- Last Synced: 2024-10-14T19:42:46.641Z (2 months ago)
- Topics: ios, open-source, swift, swiftui, template, xcode
- Language: Makefile
- Homepage:
- Size: 268 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SwiftUI-VIPER
This template generates all files that you need to create a new VIPER module in SwiftUI.## Installation instructions
To install VIPER Xcode templates clone this repo and run the following command from root folder:```make install_template```
To uninstall Xcode template run:
```make uninstall_template```
After that, restart your Xcode if it was already opened.
## VIPER short introduction
How to organize all your code and not end up with a couple of Massive View Controllers with millions of lines of code? In short, VIPER (View Interactor Presenter Entity Router) is an architecture which, among other things, aims at solving the common Massive View Controller problem in iOS apps. When implemented to its full extent it achieves complete separation of concerns between modules, which also yields testability. This is good because another problem with Apple's Model View Controller architecture is poor testability.
If you search the web for VIPER architecture in iOS apps you'll find a number of different implementations and a lot of them are not covered in enough detail. At Infinum we have tried out several approaches to this architecture in real-life projects and with that we have defined our own version of VIPER which we will try to cover in detail here.
Let's go over the basics quickly - the main components of VIPER are as follows:
- View: contains UI logic and knows how to layout and animate itself. It displays what it's told by the Presenter and it delegates user interaction actions to the Presenter. Ideally it contains no business logic, only view logic.
- Interactor: used for fetching data when requested by the Presenter, regardless of where the data is coming from. Contains only business logic.
- Presenter: also known as the event handler. Handles all the communication with view, interactor and wireframe. Contains presentation logic - basically it controllers the module.
- Entity: models which are handled by the Interactor. Contains only business logic, but primarily data, not rules.
- Router: handles navigation logic.## Modules
You can think of one VIPER module as one screen. In the Features folder we organize screens into logical groups which are basically user-stories.![iOS VIPER MODULES](/Images/project_demo.png "iOS VIPER MODULES")
## Useful links
- https://tech.badoo.com/en/article/285/ios-architecture-patterns/
- https://www.objc.io/issues/13-architecture/viper/
- https://swifting.io/2016/03/07/VIPER-to-be-or-not-to-be.html