From the course: iOS Development: Architecture

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

The model-view-presenter

The model-view-presenter

From the course: iOS Development: Architecture

Start my 1-month free trial

The model-view-presenter

- [Narrator] To solve the problem of messy view controllers, we can use an alternative to the classical MVC called Model-View-Presenter. MVP derives from the Model-View-Controller pattern. Model-View-Presenter introduces a new layer, the presenter. This new component is responsible for all non-view related logic. The view is represented by the UI view controller object, which includes the View and the Controller part from the MVC pattern. The UI view controller's code should only contain logic for displaying prepared data and capturing user actions. Everything else needs to be the presenter's concern. In the setup, the presenter prepares the data for visual presentation. Besides data formatting, it may also contain networking, persistence, or data parsing related code. What MVP does is that it separates view logic from non-view logic. This doesn't mean that now we'll have a monolithic presenter. We'll usually end up in implementing dedicated presenters for each use case. And each…

Contents