Template generator based on VIPER Architecture for Xcode.
This project contains the settings which I personaly use to generate all modules and clases for my projects.
VIPER is a backronym for View, Interactor, Presenter, Entity and Router. It’s basically an approach that implements the Single Responsibility Principle to create a cleaner and more modular structure for your iOS project. You can learn more about it in this blog post.
- Clone the repository
- Go to the project directory and run command:
sudo swift install.swift
Manual
- Download VIPER Template or clone the project
- Copy the
Design Patternfolder to~/Library/Developer/Xcode/Templates/File Templates/or create a symbolic link to that folder.
- Start Xcode and create a new group for your VIPER module
- Create a new file (
File > New > Fileor⌘N) - Choose
Design PatternandVIPER Files - Set the module name in specified text box and click Ok.
Contract/[moduleName]Contract.swiftInteractor/[moduleName]Interactor.swiftPresenter/[moduleName]Presenter.swiftView/[moduleName]View.swiftView/[moduleName]Storyboard.storyboardWireFrame/WireFrame.swift
One more steps: The generated folder w'll be imported as a reference. We have to convert to a group. The simplest solution is to remove the folder reference manually and import them as a group.
- Right click on the main module[moduleName].
- Select "Delete" button.
- Select "Remove Reference" button.
- Right click on module from your project where you want to add it.
- Select "Add files to [your-project-name]".
- Select generated VIPER module.
This is necessary to do because Xcode recognize generated files as simple folders and files.