The VIPER architectural pattern is an alternative to MVC or MVVM.
View
: Class that has all the code to show the app interface to the user and get their responses. Upon receiving a response View alerts the Presenter.Presenter
: Nucleus of a module. It gets user response from the View and works accordingly. The only class to communicate with all the other components. Calls the router for wire-framing, Interactor to fetch data (network calls or local data calls), view to update the UI.Interactor
: Has the business logic of an app. e.g if business logic depends on making network calls then it is Interactor’s responsibility to do so.Router
: Does the wire-framing. Listens from the presenter about which screen to present and executes that.Entity
: Contains plain model classes used by the Interactor.
VIPER
goes a step further by separating the view logic from the data model logic. Only the presenter
talks to the view
, and only the interactor
talks to the model
(entity
). The presenter
and interactor
coordinate with each other. The presenter
is concerned with display and user action, and the interactor
is concerned with manipulating the data.
Comments
Join the discussion for this article at here . Our comments is using Github Issues. All of posted comments will display at this page instantly.