SwiftPumpkin

Choosing an architecture

MVC, MVVM, VIPER or RIBs?

Don't optimize for how easy the code is to write today. Optimize for how easy it will be to change correctly tomorrow.

My position

When
MVCAllowed locally, for thin controllers; never the default
MVVM + RouterProduction default, and as soon as there are collections or complex elements. With @Observable it needs no binding framework, so it stays light
VIPERAdopt selectively, for complex features
RIBsWhen hierarchical business workflows and scoped lifecycles warrant it

Questions that settle MVC vs MVVM

Architectural implication
Long-lived production app, or a throwaway prototype?Long-lived → MVVM
Will the UI respond to async updates from multiple sources?MVVM, for predictable state management
Is there nontrivial derived presentation state?MVVM, for independent correctness and testability
Will requirements evolve through experiments, integrations or new features?MVVM, for extensibility
Will different teams or vendors maintain it over time?MVVM, for predictable responsibility boundaries
Does it show collections or complex, stateful elements?MVVM: diffing, loading and empty states belong in a testable model
Can an engineer or AI agent change one responsibility without understanding unrelated ones?MVVM, for localized changes
Can we verify that change automatically, without running the whole app?MVVM, for presentation logic testable without UIKit
Is it a simple static screen, like Settings, unlikely to evolve?MVC is fine

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

Architecture when AI edits the code

What it gives an AI agent
Single responsibilitySmall, well-defined change targets
Explicit module boundariesLess risk of unintended cross-feature edits
Protocol-based dependenciesClear contracts without reading every implementation
Dependency injectionEasy mocks and test environments
Independent presentation logicVerify behavior without launching the app
Explicit state ownershipNo ambiguity about where mutations happen
Consistent conventionsPredictable code generation across features
The limitNeedless indirection confuses AI too. Meaningful boundaries, not more classes

Where an AI change lands

What the agent must touch
Massive view controllerUIKit lifecycle, navigation, database callbacks, selection logic and rendering, all at once
MVVM + RouterThe ViewModel and its unit tests; navigation and rendering stay untouched
VIPERFor an eligibility rule, only the Interactor or a domain service
TakeawayThe more localized the change, the easier to review and verify

MVC vs MVVM vs VIPER

MVC
ViewControllerModel

Controller coordinates UI and domain logic.

MVVM
ViewViewModelModel

ViewModel exposes presentation-ready state and actions.

VIPER
ViewPresenterInteractorEntity

Router separately handles navigation. Presentation, business logic and navigation are separated.

MVCMVVMVIPER
BoilerplateLowModerateHigh
Separation of concernsModerateHighVery high
Presentation testabilityModerateHighHigh
Navigation ownershipControllerFlexibleRouter
UI couplingHigherLowerLower
Best suited forSimple featuresState-driven featuresComplex modular features

MVVM-R vs VIPER

MVVM-R
ViewControllerViewModelRouter

Presentation and navigation pulled out of the view controller.

VIPER
ViewPresenterInteractorRouter

Also separates business orchestration into the Interactor.

MVVM-RVIPER
View layerView + ViewControllerView
Presentation logicViewModelPresenter
Business orchestrationDomain servicesInteractor
DataEntity / ModelEntity
NavigationRouterRouter

What should drive the architecture

AskIt pushes you toward
Domain complexityCRUD screens, or chat, payments, sync?Domain boundaries, state machines, isolated rules
Runtime scaleHuge histories, big groups, heavy media?Pagination, caching, storage design, concurrency
CorrectnessOffline sends, ordering, retries?Durable queues, idempotency, sync protocols
Team stabilityStable team, or rotating contractors?Explicit contracts, narrow APIs, enforced boundaries
EvolutionMany features coming?Feature modules, extension points
Dependency volatilityCould storage, networking or a vendor change?Protocols and adapters at those seams
LongevitySix-month MVP or ten-year product?How much to invest in migration-friendly seams

Team size: one input, not the answer

Sensible defaultWhat you pay
Solo or pair, a short-lived appSwiftUI views with @Observable models, few layersFine until it has to live and change; then move to MVVM
One team, a long-lived appMVVM with injected dependencies; a router owns navigationCeremony on simple screens
Several teams in one appFeature packages behind interface modules, wired at one composition rootBuild setup, API discipline, slower clean builds
Heavily shared state, test-first teamUnidirectional flow (reducer and effects), such as TCARamp-up time, a third-party dependency, more code per feature

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