Refactoring iOS app with Coordinator Pattern for Navigation
You can also read this article in my Xcoding With Alfian blog website using the link below.
In a typical iOS app that uses MVC as the architecture, the View Controller
has to handle the navigation between other View Controllers. It means that the View Controller
must know in advance the other controllers that it will navigate to. This creates a tight coupling
between the controllers that we should avoid whenever possible.
This approach also add additional responsibility for the View Controller
thus violating the single responsibility principle (SRP)
.
Enter the Coordinator Pattern
In recent years, there is a new pattern that emerges to solve this navigation problem, it’s called the Coordinator
pattern. Here are the breakdown…