{"id":19805757,"url":"https://github.com/remirobert/appcoordinator-segue","last_synced_at":"2025-08-31T12:39:37.071Z","repository":{"id":72988816,"uuid":"72147634","full_name":"remirobert/AppCoordinator-Segue","owner":"remirobert","description":"AppCoordinator architecture with support of segue.","archived":false,"fork":false,"pushed_at":"2016-12-02T12:27:44.000Z","size":24,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-01T06:37:05.291Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/remirobert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-10-27T20:55:59.000Z","updated_at":"2025-02-23T23:10:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"be845c8f-d646-46ab-9377-be634702d488","html_url":"https://github.com/remirobert/AppCoordinator-Segue","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/remirobert/AppCoordinator-Segue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remirobert%2FAppCoordinator-Segue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remirobert%2FAppCoordinator-Segue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remirobert%2FAppCoordinator-Segue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remirobert%2FAppCoordinator-Segue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remirobert","download_url":"https://codeload.github.com/remirobert/AppCoordinator-Segue/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remirobert%2FAppCoordinator-Segue/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272982764,"owners_count":25025984,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T09:05:10.450Z","updated_at":"2025-08-31T12:39:37.062Z","avatar_url":"https://github.com/remirobert.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AppCoordinator + Segue\n\nOne of the biggest issue we have when developping iOS application, is to handle the **navigation flow**.\n\nThis is not the controllers's job to create, and configure the others UIViewControllers in the flow. Not the right place. UIViewController has to many responsabilities, and at the final we got some massive view controllers, very hard to maintain.\n\nSo currently the navigation flow code doesn't have a home.\nCoordinator is an object that handle one or more controllers, and manage the flow (navigation) of the application. And it works with the storyboards segues. The controllers doesn't know nothing about the others. Coordinators handle navigation with others coordinator.\n\n![schema](https://cloud.githubusercontent.com/assets/3276768/19786695/88ba710e-9c9f-11e6-8a17-373df0358657.png)\n\nAdvantage of the coordinators:\n - UIViewControllers are **isolated** from others, no link between them\n - High **resealability** of the controllers, everywhere in the application, even with different presentation style\n - Easy to handle the **communication** between the controllers (data flow)\n - Better logic in the code, one coordinator for one purpose\n - **Lighter** UIViewController, avoiding the massive UIViewController is our priority\n - Fully **compatible with segue and storyboard**, so keep using it 🎉 because it's great, and storyboards, and like a documentation in my point of view\n - Can be used in the **VIPER** architecture, because storyboards is tricky to use with this architecture\n \n#Coordinator\n\n```Swift\npublic protocol Coordinator: class {\n    func start()\n}\n```\nThe method start allows you to handle some action at the right time, allowing you to make things lazy.\nTo handle the communication between the coordinator and controller, delegate is used.\n\n#How is it working with segue ?\n\n```Swift\npublic protocol Coordinated: class {\n    var coordinationDelegate: CoordinationDelegate? { get set }\n}\n```\nTo be fully compatible with segue, all the UIViewController need to be a Coordinated. Then the coordinator receive the informations about the segue with this delegate : \n\n```swift\npublic protocol CoordinationDelegate: class {\n    func coordinate(from source: Coordinated, to destination: UIViewController, identifier id: String?)\n}\n```\n\nThe controllers don't have to deal with `override func performSegue(withIdentifier identifier: String, sender: Any?)` anymore, and that's a good thing.\n\n#Example\n\n - A very simple example projet was made to test the concept.\n\nThis controller has 2 segues, one to login an user, the other one to display the menu.\nBut it doesn't implement any navigation or configuration code, because the magic is happening in the coordinator. Because it's a **Coordinated** controller, it can be reused everywhere.\n```swift\nclass WelcomeViewController: UIViewController, Coordinated {\n    \n    @IBOutlet weak var labelWelcomeBack: UILabel!\n    \n    weak var coordinationDelegate: CoordinationDelegate?\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        (self.coordinationDelegate as? AppCoordinator)?.delegate = self\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremirobert%2Fappcoordinator-segue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremirobert%2Fappcoordinator-segue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremirobert%2Fappcoordinator-segue/lists"}