MVP
The point
MVP is the UIKit answer to the Massive View Controller. Three roles:
- Model — data and services.
- View —
UIViewController/UIView, passive: shows only what it is told and forwards user events to the Presenter. Described by a protocol. - Presenter — all screen logic: validation, service calls, formatting. Does not import UIKit; updates the View through its protocol.
Difference from MVC: the controller stops being the "brain" and becomes part of the View. Difference from MVVM: the Presenter imperatively calls View methods (showError) instead of publishing observable state.
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep