Scaffolding for building apps in a clean way with VIPER architecture
Scaffolding for building apps in a clean way with VIPER architecture.
VIPER inherently has a few problems:
This framework aims to address those problems by providing a set of base classes to divide your app's functionality and builder object to manage the connections.
Add pod VIPERBuilder
to your Podfile
Run pod install
Create subclasses of VIPERInteractor
, VIPERPresenter
and VIPERRouter
as needed
Create a strong reference to an instance of VIPERBuilder
with the new subclasses specified. Lazy loading in Swift will ensure that the builder object is available as soon as it is called
lazy var viperBuilder: VIPERBuilder<NewInteractor, NewPresenter, NewRouter> = { return VIPERBuilder(controller: self) }()
Note: If not all classes are needed for the implementation passing the superclass to the Builder object is supported
For a more detailed implementation, please check out the demo project included in this repo
This framework provides three base classes for the three main parts of VIPER: Interactor, Presenter, Router. Each class should contain certain pieces of code and has references to other classes for specific reasons, however these can be extended through subclassing.