DevPrep

All topics › Software architecture

Coordinator — why and how to implement it?

Middle PRO

The point

A Coordinator moves navigation out of screens. A controller does not know which screen is next or how to build it: it reports an event (onLoggedIn, a delegate), and the coordinator decides what to show, creates the screen and its dependencies. Screens become reusable (the same LoginViewController in onboarding and in settings), flows become explicit and testable, and the UIViewController stops doing pushViewController and dependency assembly.

The rest of this answer, with code and interview follow-ups, is in the DevPrep app.

Read the full answer in DevPrep

Practice this before your interview

DevPrep turns these answers into one-minute challenges: what does this code print, find the bug, mock interviews. One challenge a day.

Get DevPrep on the App Store