SwiftPumpkin

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

UpdatesDataEventsRendersControllerCoordinates everythingModelData + business logicViewUI + rendering
calls or tellsreports backIn UIKit MVC, the Model and View don't communicate directly.
  • 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.
PartOwnsLooks like
ModelData, state, domain logicStructs, entities, repositories
ViewDisplay information and capture interactionsUIView, UILabel, UIButton
ControllerHandle events, coordinate model and viewUIViewController

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 logicMVC.
Nontrivial presentation logic or evolving UI stateMVVM.
Substantial independent business orchestrationMVVM + Interactor, or VIPER.
Complex hierarchical business workflowsConsider RIBs.

Compared

What each technique addresses

Architectural problem it addresses
MVCCoupling between data and UI
MVVMMassive ViewControllers
MVVM + RouterCoupling between feature logic and navigation
VIPERMassive ViewModels and mixed presentation/business logic
Protocol-oriented programmingCoupling to concrete implementations
Dependency injectionCoupling to dependency construction
Feature modularizationCoupling across feature boundaries
FacadesLeakage of subsystem complexity

Where MVC is enough

Why
Static About or legal screenNo meaningful presentation state
Simple image previewMostly rendering and gestures
Debug or internal toolLow complexity and maintenance expectations
Throwaway proof of conceptOptimizing for learning, not longevity
Wrapper around a system componentUIKit already does most of the work
Static informational sheetData 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.

30-second answer

Explain MVC in 30 seconds.

SwiftAsked directly

What is "Massive View Controller" actually a symptom of?

System designAsked indirectly

Two tabs show the same notes. You edit in one and the other shows stale data. What's wrong with the design?

iOS codingAsked indirectly

You inherit a 1,500-line view controller. What do you extract first, and why in that order?

System designAsked indirectly

When would you move a team off plain MVC, and how?

Read it in the app's source