{"id":15391225,"url":"https://github.com/pjechris/magellan","last_synced_at":"2025-12-11T22:53:58.791Z","repository":{"id":25210400,"uuid":"28634390","full_name":"pjechris/Magellan","owner":"pjechris","description":"Routing dead simple","archived":false,"fork":false,"pushed_at":"2018-12-18T15:48:30.000Z","size":143,"stargazers_count":15,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T22:47:33.903Z","etag":null,"topics":["navigation","route","router","routing","swift","viewcontroller"],"latest_commit_sha":null,"homepage":"","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/pjechris.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-30T14:52:00.000Z","updated_at":"2023-07-29T09:50:46.000Z","dependencies_parsed_at":"2022-08-23T21:11:04.967Z","dependency_job_id":null,"html_url":"https://github.com/pjechris/Magellan","commit_stats":null,"previous_names":["akane/magellan"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjechris%2FMagellan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjechris%2FMagellan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjechris%2FMagellan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjechris%2FMagellan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pjechris","download_url":"https://codeload.github.com/pjechris/Magellan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249167412,"owners_count":21223503,"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","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":["navigation","route","router","routing","swift","viewcontroller"],"created_at":"2024-10-01T15:10:23.774Z","updated_at":"2025-12-11T22:53:58.758Z","avatar_url":"https://github.com/pjechris.png","language":"Swift","readme":"# Magellan\n[![Build Status](https://travis-ci.org/akane/Gaikan.svg?branch=travis)](https://travis-ci.org/akane/Nabigeta)\n\nNabigeta provides simple API to declare routes for navigation. Compatible with trait environments.\n\n## Why\n\nClassic app navigation tights View Controllers together, making hard to change workflow when needed.\n\nMagellan helps you by defining a simple routing system abstracting View Controllers usage, making it easier to introduce changes, deep linking, tagging, and so on...\n\n## Usage\n\n### 1 - Declare an enum with your routes\n\n```swift\nenum AppRoutes {\n  case book(Book)\n  case cart(Cart)\n}\n```\n\n### 2 - Declare your route handler\n\n```swift\nfunc route(for context: AppRoutes, _ sender: UIViewController?) -\u003e Route? {\n  switch context {\n  case .book(let book):\n    return Route(BookViewController())\n  case .cart(let cart):\n    return Route(CartViewController()).present(PresentationModal())\n  }\n}\n```\n\n### 3 - Create your navigation\n\n```swift\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n  var navigation: Navigation! = nil\n\n  func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -\u003e Bool {\n    navigation = Navigation(router: route(for::))\n  }\n}\n```\n\n### 4 - Use it!\n\n```swift\n\nclass ViewController {\n  var cart: Cart!\n\n  func onCartTapped() {\n      navigate(to: .cart(cart))\n  }\n}\n```\n\n# Advanced Usage\n## Presentation\n\nMagellan provides some default Presentation strategies:\n\n- PresentationPush\n- PresentationModal\n- PresentationPopover\n- PresentationSegue\n\nIf none of them feed your needs, you can provide your own custom presentation just by creating a class/struct implementing the ```PresentationStrategy``` protocol.\n\n## Stopping navigation\n### Navigate back\n\nYou can cancel navigation from source controller:\n\n```swift\n  bookViewController.navigateBack() // come back to BookViewController\n```\nYou can also stop navigation from destination controller:\n\n```swift\n  cartViewController.navigationTerminated(status: .canceled) // dismiss CartViewController\n```\n\nYou can also be notified when navigations are stopped:\n\n```swift\n  viewController\n    .navigate(to: .cart(self.cart))\n    .onTerminate { status in\n      if status == .canceled {\n        print(\"author controller cancelled\")\n      }\n    }\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpjechris%2Fmagellan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpjechris%2Fmagellan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpjechris%2Fmagellan/lists"}