Xcode custom template for easily creating a Viper architecture module.
You'll get useful boilerplate out of the box, with the module name placed in the relevant classes' and protocols' names.
The module has two types, based on the UI framework your'e using. Select the one that fits your project.
See SwiftUI Viper Template or UIKit Viper Template for the complete architecture template.
- View / ViewController - The responsibility of the view is to send the user actions to the presenter and shows whatever the presenter tells it.
- Presenter - Its responsibility is to get the data from the interactor on user actions and after getting data from the interactor, it sends it to the view to show it. It also asks the router for navigation.
- Router - It has all navigation logic for describing which screens are to be shown when.
- Interactor - This is the backbone of an application as it contains the business logic. It has access to the world outside of the module.
- Wireframe - A factory for creating the view with all its dependencies.
The module templates can simply be installed via terminal. run the following command:
curl "https://raw.githubusercontent.com/TelemTobi/Viper-Module-Template/main/install_template.sh" | bash
In order to install the templates manually, You'll have to first download the repository.
Now either run the install.template.sh
file in your terminal:
sh <PATH_TO_SHELL_FILE>
or move the Viper.xctemplate
to:
/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates/Modules
And your'e all set! π