1 of 22 · UI patterns
MVC
MVC (Model–View–Controller) is an architectural pattern that separates an application's data, presentation, and coordination logic. It is the traditional architectural pattern in UIKit-based iOS development.
How it's wired
- Views send actions to the controller (target-action, delegate).
- The model notifies the controller when it changes, and the controller updates the views.
- Views and models never talk directly.
| Part | Owns | Looks like |
|---|---|---|
| Model | Data, state, domain logic | Structs, entities, repositories |
| View | Display information and capture interactions | UIView, UILabel, UIButton |
| Controller | Handle events, coordinate model and view | UIViewController |
A thin controller is fine
Nothing to extract: data comes in and is rendered.
AboutViewController
An AboutViewModel, a protocol and mocks would add indirection, not value.
final class AboutViewController: UIViewController {
@IBOutlet private var versionLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
title = "About"
versionLabel.text =
Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
}
}MVC is reasonable when the controller is genuinely thin.
Why MVC becomes problematic at scale
- MVC is the starting pattern. Every other UI pattern here is a refinement of it: MVVM pulls presentation out of the controller, a router pulls out navigation, and VIPER splits business orchestration from presentation.
- The infamous Massive View Controller problem.
- As a feature grows, developers tend to put everything into the controller: too many responsibilities concentrated in a single controller.
- This leads to tightly coupled dependencies, difficult unit testing, poor reusability, and expensive migrations.
- However, Massive View Controller is not an inherent requirement of MVC. It's a consequence of poor responsibility boundaries.
- Good dependency boundaries (protocol-oriented dependencies, facades, dependency injection, feature modularization) keep an MVC codebase healthier, but they don't stop responsibilities piling into the controller. That's what MVVM and routers are for.
My decision rule
| No meaningful presentation logic | MVC. |
|---|---|
| Nontrivial presentation logic or evolving UI state | MVVM. |
| Substantial independent business orchestration | MVVM + Interactor, or VIPER. |
| Complex hierarchical business workflows | Consider RIBs. |
Compared
What each technique addresses
| Architectural problem it addresses | |
|---|---|
| MVC | Coupling between data and UI |
| MVVM | Massive ViewControllers |
| MVVM + Router | Coupling between feature logic and navigation |
| VIPER | Massive ViewModels and mixed presentation/business logic |
| Protocol-oriented programming | Coupling to concrete implementations |
| Dependency injection | Coupling to dependency construction |
| Feature modularization | Coupling across feature boundaries |
| Facades | Leakage of subsystem complexity |
Where MVC is enough
| Why | |
|---|---|
| Static About or legal screen | No meaningful presentation state |
| Simple image preview | Mostly rendering and gestures |
| Debug or internal tool | Low complexity and maintenance expectations |
| Throwaway proof of concept | Optimizing for learning, not longevity |
| Wrapper around a system component | UIKit already does most of the work |
| Static informational sheet | Data is passed in and rendered directly |
Expert notes
- UI architecture is not just about organizing UI code. It's about controlling state, responsibility, coupling and the cost of change.
- In UIKit this matters because UIViewController already owns lifecycle, view hierarchy, layout and interaction handling. Adding presentation logic, business orchestration and navigation makes it an architectural bottleneck.
- These techniques solve different dimensions of complexity. You can't compensate for poor UI architecture with protocols and dependency injection: a 3,000-line view controller with perfectly injected dependencies is still a poorly structured view controller.
- Not MVC, even solo: messaging and social, auth and onboarding, search, checkout, offline-capable apps, features with several async sources. Their state and evolution justify presentation boundaries from day one.
- Allow MVC locally, inside an MVVM app, as long as dependency and navigation contracts stay consistent. Don't make it the default for a substantial production UIKit app.
- AI lowers the cost of boilerplate, so the threshold for MVVM is lower still. Abstractions still need a job.
Check yourself
Answer out loud before you reveal. Recall is what makes it stick.
Explain MVC in 30 seconds.
- In UIKit MVC the controller mediates between model and view, and UIViewController also owns the lifecycle, so responsibilities pile up there.
- A massive view controller means the model layer is missing.
- I keep MVC for simple screens with little state; once a screen has real logic, I move state and rules into model objects that screens observe and pull navigation into a router.
- At scale, that's MVVM with a router.
What is "Massive View Controller" actually a symptom of?
- A missing model layer.
- Teams treat the model as plain structs, so networking, caching, validation and state all land in the only class left, the view controller.
- Size is the symptom.
- The fix is to give the model layer real objects: a
NotesStorethat owns loading, saving and the current state. - Then the view controller goes back to being glue, and the logic becomes unit-testable without UIKit.
Two tabs show the same notes. You edit in one and the other shows stale data. What's wrong with the design?
- Each screen got its own copy of the data, so there's no single source of truth.
- In MVC this is the real scaling problem, more than file size.
- Make one model object own the notes and have both screens observe it, through a delegate, a notification or
@Observable. - One writer, many readers.
- View controllers render state they don't own and never push data into each other.
You inherit a 1,500-line view controller. What do you extract first, and why in that order?
- Extract by value, not by line count.
- First, business logic and networking go into model-layer objects, because that's what you most need to test.
- Second,
UITableViewDataSourcegoes into its own type. - Third, independent regions of the screen become child view controllers via
addChild(_:). - Do it one slice per PR, with characterization tests first, so behavior never changes during the move.
When would you move a team off plain MVC, and how?
- When the pain is structural, not cosmetic.
- Signals: navigation decisions scattered across view controllers, business rules duplicated between screens, several engineers colliding in the same files.
- Address each signal directly.
- Use coordinators for flow, shared model objects for rules, and feature modules for ownership.
- Migrate screen by screen behind the same interfaces.
- A big-bang rewrite to a new architecture rarely pays back.