VIPER
The point
VIPER is MVP evolved in the spirit of Clean Architecture for UIKit: a screen (module) is split into five roles with protocols between them.
- View — a
UIViewController, passive: shows display-ready data (strings, not models) and forwards events to the Presenter. - Interactor — the module's use-case logic: "load orders", "pay". It gets data through services/repositories; it does not hit the network itself.
- Presenter — ties everything together: receives View events, calls the Interactor and Router, turns Entities into view models for the View.
- Entity — plain data models (
struct). - Router (Wireframe) — navigation and assembly of the next module.
There is usually also an Assembly/Builder that creates all parts and wires the references: the View owns the Presenter, the Presenter owns the Interactor and Router; back references (presenter.view, interactor.output, router.viewController) are weak.
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep