MVP (Model view presenter) - DevOli/Marvel-chars GitHub Wiki
Model–view–presenter (MVP) is a derivation of the model–view–controller (MVC) architectural pattern, and is used mostly for building user interfaces. In MVP, the presenter assumes the functionality of the "middle-man". In MVP, all presentation logic is pushed to the presenter.
- Model is a plain object that’s used by the presenter. In our case, it’s simply an Item with a title property.
- Presenter is UIKit-independent. It receives messages from the view and performs all business logic. After completing its job, it prepares data for the view to display in the suitable format.
- View contains view controllers and XIB files (if any) and doesn’t do much on its own. Its responsibility is to send events to the presenter and wait for the result. After getting the result, it updates itself if needed.
Advantages:
- Distribution.
- Testability.
- Easy to use.