MVC
The point
MVC in Cocoa is not the "classic" Smalltalk MVC, and iOS interviews ask about Apple's variant:
- Model — data and business logic. Knows nothing about the UI.
- View —
UIViewand its subclasses. Shows what it is given and reports user actions (target-action, delegate). Knows nothing about the Model. - Controller —
UIViewController. The only one that knows both: reads the Model, configures the View, handles events and updates the Model.
The key difference from Smalltalk MVC: there the View observes the Model directly. In Apple's version View and Model do not know each other; only the Controller links them. So a Model is reusable with any UI, and a View with any data.
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep