Coordinator
Coordinator copied to clipboard
A drop-in, ready to use, collection of Coordinator protocols
Concepts
A Coordinator is an object that manages iOS applications navigation flow while keeping UIViewControllers separate and independent.
By itself a Coordinator can only hold references to others Coordinators and to his parent coordinator (if available), to gain navigation flow management it must be paired with a UINavigationController or UITabBarController.
Choose one of the two protocols based on your navigation flow needs:
-
NavCoordinator
Holding aUINavigationController -
TabCoordinator
Holding aUITabBarController
What a Coordinator should do
- Push a
UIViewController/UINavigationController/UTabBarControllerof anotherCoordinator - Create
Couples object - Present
Coordinators - Be invisible to
UIViewControllers and only known byViewModels - Hold
Dependenciesin case of Dependency Injection
What a Coordinator should not do
- Perform anything other than navigation (i.e. network calls)
How to use Xcode Templates
- Close Xcode
- If not already present, create a folder named
Sourcein the following path:~/Library/Developer/Xcode/Templates/File Templates/ - Move the
.xctemplates of choice in:~/Library/Developer/Xcode/Templates/File Templates/Source/ - Open Xcode and try to create a new file with:
Xcode > File > New > File...
Example project requirements
- Xcode 10.0+
- Swift 4.2+
- iOS 8.0+
Image source requirements
- Sketch 53+
Credits
- Soroush Khanlou, for his original
Coordinatorproposal- The Coordinator (January 20, 2015)
- Coordinators Redux (October 05, 2015)
- Presenting Coordinators 📹 (October 30, 2015)
- Migrating To Coordinators (April 25, 2017)
- Model Mutation In Coordinators (May 02, 2017)
- Back Buttons and Coordinators (May 08, 2017)
- Martin Fowler, for his original
Application Controllerconcept