{"id":19313748,"url":"https://github.com/geektree0101/cleanroute","last_synced_at":"2026-06-09T20:31:24.791Z","repository":{"id":141412239,"uuid":"209939465","full_name":"GeekTree0101/CleanRoute","owner":"GeekTree0101","description":"CleanSwift, Convenience routing example between scenes","archived":false,"fork":false,"pushed_at":"2019-09-28T12:08:41.000Z","size":72,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-14T21:28:41.372Z","etag":null,"topics":["clean-architecture","ios","swift"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GeekTree0101.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2019-09-21T06:54:07.000Z","updated_at":"2019-09-28T12:08:43.000Z","dependencies_parsed_at":"2023-06-12T13:15:28.448Z","dependency_job_id":null,"html_url":"https://github.com/GeekTree0101/CleanRoute","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GeekTree0101/CleanRoute","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeekTree0101%2FCleanRoute","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeekTree0101%2FCleanRoute/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeekTree0101%2FCleanRoute/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeekTree0101%2FCleanRoute/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GeekTree0101","download_url":"https://codeload.github.com/GeekTree0101/CleanRoute/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeekTree0101%2FCleanRoute/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34125332,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"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":["clean-architecture","ios","swift"],"created_at":"2024-11-10T00:41:02.213Z","updated_at":"2026-06-09T20:31:24.785Z","avatar_url":"https://github.com/GeekTree0101.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CleanRouter\n\u003e CleanSwift, Convenience routing example between scenes [Research Repository]\n\n[![CI Status](https://github.com/Geektree0101/CleanRoute/workflows/ci/badge.svg)](https://geektree0101.github.io/)\n\n\u003cimg src=\"https://github.com/GeekTree0101/CleanRoute/blob/master/res/CleanRoute.png\" /\u003e\n\n\n### Hard codeded finding previous viewController logic\n\n\u003e EditRouter.swift\n```swift\nfunc movingFromParent(segue: UIStoryboardSegue?) {\n    if let segue = segue {\n      let destinationVC = segue.destination as? ShowViewController\n      destinationVC?.router?.dataStore?.content = self.dataStore?.content\n    } else {\n      let destinationVC = self.viewController?.navigationController?.topViewController as? ShowViewController\n      destinationVC?.router?.dataStore?.content = self.dataStore?.content\n    }\n}\n\nfunc dismiss(segue: UIStoryboardSegue?) {\n    if let segue = segue {\n      let destinationVC = segue.destination as? ShowViewController\n      destinationVC?.router?.dataStore?.content = self.dataStore?.content\n    } else {\n      let parentNavVC = self.viewController?.navigationController?.presentingViewController as? UINavigationController\n      let destinationVC = parentNavVC?.topViewController as? ShowViewController\n      destinationVC?.router?.dataStore?.content = self.dataStore?.content\n      self.viewController?.dismiss(animated: true)\n    }\n}\n```\nIn Storyboard case, doesn't matter about finding previous viewController. \nbut, Hard codeded find previous viewController logic isn't only hard to define previous viewController also easy to occur unexpected bugs. \n\n\n\n### Using defined sourceVC prop from DataPassing\nIn my case, EditorDataPassing supports defined previous viewController property. aka sourceVC(UIViewController) \n\n\u003e EditorRouter.swift\n```swift\nprotocol EditorDataPassing: class {\n  \n  var dataStore: EditorDataStore? { get }\n  var sourceVC: UIViewController? { get set } // \u003c- Here!!!!!\n}\n```\n\n\u003e ShowRouter.swift\n```swift\n\nextension ShowRouter: ShowRouterLogic {\n  \n  func presentEditor() {\n    let editorVC = EditorViewController.init()\n    \n    editorVC.router?.dataStore?.content = dataStore?.content\n    editorVC.router?.sourceVC = vc // \u003c- Here!!!!!\n    \n    let navVC = UINavigationController(rootViewController: editorVC)\n    vc?.present(navVC, animated: true, completion: nil)\n  }\n  \n  func pushEditor() {\n    let editorVC = EditorViewController.init()\n    \n    editorVC.router?.dataStore?.content = dataStore?.content\n    editorVC.router?.sourceVC = vc // \u003c- Here!!!!!\n    \n    vc?.navigationController?.pushViewController(editorVC, animated: true)\n  }\n}\n\n```\n\n\u003e EditorRouter.swift\n```swift\nfunc movingFromParent(segue: UIStoryboardSegue?) {\n    if let segue = segue {\n      let destinationVC = segue.destination as? ShowViewController\n      destinationVC?.router?.dataStore?.content = self.dataStore?.content\n    } else {\n      let destinationVC = self.sourceVC as? ShowViewController\n      destinationVC?.router?.dataStore?.content = self.dataStore?.content\n    }\n}\n\nfunc dismiss(segue: UIStoryboardSegue?) {\n    if let segue = segue {\n      let destinationVC = segue.destination as? ShowViewController\n      destinationVC?.router?.dataStore?.content = self.dataStore?.content\n    } else {\n      let destinationVC = self.sourceVC as? ShowViewController\n      destinationVC?.router?.dataStore?.content = self.dataStore?.content\n      self.viewController?.dismiss(animated: true)\n    }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeektree0101%2Fcleanroute","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeektree0101%2Fcleanroute","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeektree0101%2Fcleanroute/lists"}