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.
- MVVM with a Router is my production default.
- MVC is fine locally, when a controller is genuinely thin.
- Application complexity and expected evolution matter far more than current team size.
My position
| When | |
|---|---|
| MVC | Allowed locally, for thin controllers; never the default |
| MVVM + Router | Production default, and as soon as there are collections or complex elements. With @Observable it needs no binding framework, so it stays light |
| VIPER | Adopt selectively, for complex features |
| RIBs | When 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 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 |
Architecture when AI edits the code
| What it gives an AI agent | |
|---|---|
| Single responsibility | Small, well-defined change targets |
| Explicit module boundaries | Less risk of unintended cross-feature edits |
| Protocol-based dependencies | Clear contracts without reading every implementation |
| Dependency injection | Easy mocks and test environments |
| Independent presentation logic | Verify behavior without launching the app |
| Explicit state ownership | No ambiguity about where mutations happen |
| Consistent conventions | Predictable code generation across features |
| The limit | Needless indirection confuses AI too. Meaningful boundaries, not more classes |
Where an AI change lands
| What the agent must touch | |
|---|---|
| Massive view controller | UIKit lifecycle, navigation, database callbacks, selection logic and rendering, all at once |
| MVVM + Router | The ViewModel and its unit tests; navigation and rendering stay untouched |
| VIPER | For an eligibility rule, only the Interactor or a domain service |
| Takeaway | The 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.
| MVC | MVVM | VIPER | |
|---|---|---|---|
| Boilerplate | Low | Moderate | High |
| Separation of concerns | Moderate | High | Very high |
| Presentation testability | Moderate | High | High |
| Navigation ownership | Controller | Flexible | Router |
| UI coupling | Higher | Lower | Lower |
| Best suited for | Simple features | State-driven features | Complex 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-R | VIPER | |
|---|---|---|
| View layer | View + ViewController | View |
| Presentation logic | ViewModel | Presenter |
| Business orchestration | Domain services | Interactor |
| Data | Entity / Model | Entity |
| Navigation | Router | Router |
What should drive the architecture
| Ask | It pushes you toward | |
|---|---|---|
| Domain complexity | CRUD screens, or chat, payments, sync? | Domain boundaries, state machines, isolated rules |
| Runtime scale | Huge histories, big groups, heavy media? | Pagination, caching, storage design, concurrency |
| Correctness | Offline sends, ordering, retries? | Durable queues, idempotency, sync protocols |
| Team stability | Stable team, or rotating contractors? | Explicit contracts, narrow APIs, enforced boundaries |
| Evolution | Many features coming? | Feature modules, extension points |
| Dependency volatility | Could storage, networking or a vendor change? | Protocols and adapters at those seams |
| Longevity | Six-month MVP or ten-year product? | How much to invest in migration-friendly seams |
Team size: one input, not the answer
| Sensible default | What you pay | |
|---|---|---|
| Solo or pair, a short-lived app | SwiftUI views with @Observable models, few layers | Fine until it has to live and change; then move to MVVM |
| One team, a long-lived app | MVVM with injected dependencies; a router owns navigation | Ceremony on simple screens |
| Several teams in one app | Feature packages behind interface modules, wired at one composition root | Build setup, API discipline, slower clean builds |
| Heavily shared state, test-first team | Unidirectional flow (reducer and effects), such as TCA | Ramp-up time, a third-party dependency, more code per feature |
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 |