For iOS engineers getting ready for interviews
Swift design patterns, built into one tiny app you can run.
One small feature, write a thank-you note and pick a pumpkin, built 22 ways. Each lesson shows the wiring, the code, what it costs and when I'd use it. Then you practice saying it out loud.

The one question behind every pattern
Which way does the arrow point?
- Every pattern decides who is allowed to know about whom.
- Stable things, your model and your rules, shouldn't depend on volatile things: screens, disks, networks.
- When an arrow points the wrong way, flip it with a protocol and pass the dependency in.
Why a refresher, even after years of shipping
Patterns are vocabulary and building blocks. Even if no interviewer asks about Decorator or Composite by name, refreshing them widens the set of solutions you can reach for in a system design round.
- RecognitionSpot the patterns you already use by instinct in production.
- CompositionCombine several of them to solve one hard architecture problem.
- CommunicationExplain a design in a sentence, using shared engineering vocabulary.
- JudgmentNotice when a pattern adds more complexity than it removes.
- It's like revisiting data structures. You don't study heaps because someone might ask you to implement one.
- With AI writing more of the implementation, the vocabulary to specify, review and reason about software structure matters more.
Your progress
Start with MVC0of 22 patterns complete
0of 111 cards nailed
0shaky cards to revisit
- New
- Started
- Halfway
- Almost
- Mastered
- Complete
Each pumpkin is built a row of bricks at a time as you nail its cards. Progress is saved in this browser, with no account needed.
Learn
Every lesson has the same shape, so you always know where you are: wiring, code, trade-offs, when to use it, then check yourself.
1 · UI patterns
- MVCMVC (Model–View–Controller) is an architectural pattern that separates an application's data, presentation, and coordination logic.
- MVVM (+ Router)Move logic into a view model that never imports UIKit, then bind the view to it.
- MVP (Passive View)The view is passive: it forwards events and obeys commands.
- VIPERSplit one screen into View, Interactor, Presenter, Entity and Router, each talking through protocols.
- Clean Swift (VIP)View → Interactor → Presenter → View: data goes one way round a loop, as plain Request/Response/ViewModel structs.
- Coordinator / RoutingPull navigation out of view controllers.
- Unidirectional (TCA / Redux)State changes in exactly one place: a reducer that takes the current state and an action.
2 · System architecture
- Dependency InjectionPass dependencies in, preferably through init, instead of reaching for .shared.
- Protocol-Oriented ProgrammingDefine behavior as protocols with default implementations, then compose instead of subclassing.
- Facade & ModulesHide a messy subsystem behind one small API, inside a module whose internals the compiler protects.
- RepositoryOne collection-like API for your models that hides whether data came from cache, disk or network.
- Factory & BuilderA factory picks and wires the concrete type.
- Services vs SingletonsA singleton answers 'how many exist?'.
- Decoupled LayersUI → Domain ← Data.
- Feature ModulesSplit each feature into a tiny interface module and an implementation module, wired at one composition root.
3 · Callbacks and concurrency
- DelegateOne-to-one callback through a protocol, held weakly so parent and child don't retain each other.
- Pub/SubPublish an event once and any number of subscribers react, without the publisher knowing them.
- Completion Handlers"Call me back when you're done." The rule is exactly once on every path, and nothing enforces it.
- Promises → async/awaitFutures made the callback contract an object, and async/await made it the language.
- Swift 6 ConcurrencyIsolation instead of locks: actors and the main actor own state, Sendable values cross between them, and tasks form a cancellable tree.