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
- [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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Introduction to fundamental architectural design patterns57s
-
(Locked)
The model-view-controller3m 50s
-
(Locked)
The model-view-presenter1m 22s
-
(Locked)
MVP example2m 41s
-
(Locked)
Refactoring to MVP: Model2m 26s
-
(Locked)
Refactoring to MVP: Presenter2m 32s
-
(Locked)
Refactoring to MVP: View controller4m 29s
-
(Locked)
The Model-View-ViewModel pattern1m 15s
-
(Locked)
Implementing one-way binding, part 11m 34s
-
(Locked)
Implementing one-way binding, part 23m 55s
-
-
-
-
-
-
-