Chapter 11: Easy Navigation with Coordinators
An iOS app is usually a collection of single screens somehow connected to each other. Inexperienced developers often present a view controller from another view controller, because this is easy to implement and it is often shown that way in tutorials and demo code. But, for apps that need to be maintained over a long period of time, we need a pattern that is easier to understand and easier to change.
The coordinator pattern is very easy to implement and still manages to decouple the navigation between views of the app from the presentation of the information. In the coordinator pattern, a structure called a coordinator is responsible for navigating between views. View controllers tell the coordinator that the user interacted with the app and the coordinator decides which view controller should become responsible for the screen next.
As a bonus, the coordinator pattern makes testing navigation code simpler and more robust, and as a...