Group Group Group Group Group Group Group Group Group

Coordinator Pattern (c. 23): Multiple styles of navigation within a coordinator

In the Coordinator Pattern introduced in Chapter 23 of Design Patterns by Tutorials we specify that the specific Coordinator only knows the order of view controllers but not how to present them, and vice versa for the specific Router.

However you can imagine a scenario in which a Coordinator flow needs multiple types of navigation – there may be a “push”-based flow throughout, but that occasional view controllers need to be presented modally as an “interruption”.

For example in a freemium application there may be an “Upgrade flow” that lays out a series of view controllers to convince the user to upgrade, but that the “terms of service” view controller the user can click to see is actually presented modally.

How do we go about organizing this considering the coordinator should not know about the presentation and the router should not depend on any particular coordinator/ view controllers?