Implementation of Coordinator design pattern. It is the application architecture pattern for iOS, carefully designed to fit into UIKit; so much it could easily be UICoordinator
.
Since this is core architectural pattern, it’s not possible to explain its usage with one or two clever lines of code. Give it a day or two; analyze and play around. I’m pretty sure you’ll find it worthy of your time and future projects.
My preferred method is to integrate Coordinator into the project manually. Just drag Coordinator
folder into your project — it‘s only a handful of files.
If you prefer to use dependency managers, see below. Releases are tagged with Semantic Versioning in mind.
CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Coordinator into your Xcode project using CocoaPods, specify it in your Podfile
:
pod 'Coordinator', :git => 'https://github.com/radianttap/Coordinator.git'
You must use direct link through :git
since CocoaPods central repository contains a framework of the same name.1
Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.
You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthage
To integrate Coordinator into your Xcode project using Carthage, specify it in your Cartfile
:
github "radianttap/Coordinator"
The why and how and...
- the Pattern
- the Library
- the Class
- recommended Implementation
On my blog: Coordinator: the missing pattern in UIKit
Rough history of development, also on my blog. I did not come up with the library all at once, it was a gradual process as all good things are.
Soroush Khanlou: Coordinators Redux
Andrey Panov: Coordinators Essential tutorial
Matthew Wyskiel: Protocol-Oriented App Coordinators in Swift
Coordinators are fairly old pattern but it was Soroush who brought them under iOS developer spotlight in 2015. My library follows the core idea but employs a different implementation.
Bill Dudney, WWDC 2014, session 224: Core iOS Application Architectural Patterns
Andy Matuschak & Colin Barrett, WWDC 2014, session 229: Advanced iOS Application Architecture and Patterns
I file these two talks under essential education for any iOS developer. While not directly associated with Coordinator pattern, you should still carefully watch and listen to understand what it means to “fit inside iOS SDK”.
MIT, as usual.
Footnotes
-
That framework seems long abandoned and my requests to remove it and thus allow me to publish mine were unsuccessful. ↩