{"id":20199511,"url":"https://github.com/andylindebros/swiftreduxrouter","last_synced_at":"2026-05-05T01:36:27.298Z","repository":{"id":37403032,"uuid":"491461089","full_name":"andylindebros/SwiftReduxRouter","owner":"andylindebros","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-13T02:22:34.000Z","size":1124,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-03-13T03:29:57.944Z","etag":null,"topics":["redux","routing","swift","swift-redux","swiftui"],"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/andylindebros.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}},"created_at":"2022-05-12T10:09:27.000Z","updated_at":"2024-03-13T03:30:03.603Z","dependencies_parsed_at":"2023-12-28T18:28:44.702Z","dependency_job_id":"845c853f-ede5-4f9e-94cb-0c4573ed5915","html_url":"https://github.com/andylindebros/SwiftReduxRouter","commit_stats":null,"previous_names":[],"tags_count":73,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andylindebros%2FSwiftReduxRouter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andylindebros%2FSwiftReduxRouter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andylindebros%2FSwiftReduxRouter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andylindebros%2FSwiftReduxRouter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andylindebros","download_url":"https://codeload.github.com/andylindebros/SwiftReduxRouter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241637149,"owners_count":19994925,"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":["redux","routing","swift","swift-redux","swiftui"],"created_at":"2024-11-14T04:37:57.597Z","updated_at":"2026-05-05T01:36:27.291Z","avatar_url":"https://github.com/andylindebros.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SwiftRouter\n\nSwiftRouter maps navigation to routes that provides SwiftUI views controlled by a NavigationState.\n\n![Demo](https://github.com/andylindebros/SwiftReduxRouter/blob/master/SwiftReduxRouterExample/SwiftReduxRouter.gif)\n\nIt is written for SwiftUI apps based on a Redux pattern. This Router provides a NavigationState and a RouterView backed with UIKit. The NavigationState controls the navigation and you can easily go back and forth in the action history and the RouterView will navigate to a route.\nThe routerView uses the UINavigationController in the background since the current SwiftUI NavigationView does not provide necessary methods to make it work.\n\nThis package also provides a nessecary actions to use to changed the navigation state.\n\n## Works with:\n\n- SwiftUIRedux: https://github.com/andylindebros/SwiftUIRedux\n\n## Install with Swift Package Manager\n\n```Bash\n\ndependencies: [\n    .package(url: \"https://github.com/lindebrothers/SwiftReduxRouter.git\", .upToNextMajor(from: \"\u003cDesired version\u003e\"))\n]\n```\n\n## Implementation\nSee examples how to implement in the Example project within this package.\n\n#### Deeplinks\nSetup your scheme and deep links will be opened by the router.\n\nFollowing rules apply to the example implementation above:\n\n- `swiftrouter://example.com/tab1/page/2` will be pushed to the first tab\n- `swiftrouter://example.com/tab1/page/1` will be selected in the first tab\n- `swiftrouter:///tab2/page/2` will be selected in and will select the second tab. \n- `swiftrouter:///tab2/page/1` will be pushed to the second tab\n- `swiftrouter:///standalone/page/1` will be presented in the standalone navigationController on top of the tab bar\n- `swiftrouter:///standalone/page/2` will be pushed to the presented standalone navigationController\n- `swiftreduxrouter:///page/1` will be presented in a new navigationController on top of the tab bar\n- `swiftrouter:///tab1` will select the first tab\n\nYou can dispatch the Deeplink anywhere in your app to navigate to any desired route.\n```Swift\nButton(action: {\n    store.disptach(Deeplink(url: URL(string: \"/tab2/page/2\")).action(for: store.navigation))\n}) {\n    Text(\"Take me to page two in the second tab\")\n}\n```\n\nTest deeplinks from the terminal:\n```Bash\nxcrun simctl openurl booted '\u003cINSERT_URL_HERE\u003e'\n```\n\n\n## URL Routing.\n\nThe router uses URL routing just like a web page. URL routing makes it easy to\norganize your project and to work with deep links and Universal links. Choose a\npath to your route. Make sure the path is unique, the router maps the first\nmatching route to a path.\n\n```\n/mypath/to/a/route\n```\n\nYou can make parts of the URL dynamic and attach multiple rules\n\n```\n/user/\u003cstring:username\u003e\n```\n\nSupported dynamic parameters are:\n\n- string - `user/\u003cstrng:username\u003e`\n- integer - `user/\u003cint:userId\u003e`\n- float - `whatever/\u003cfloat:someFloat\u003e`\n- uuid - `tokens/\u003cuuid:token\u003e`\n- path - `somepath/\u003cpath:mypath\u003e` will match everything after `somepath/`\n\n## TabBar or a single UINavigationController\nIf you set the tab property of the SwiftRouter.Model in the init state, the SwiftRouter.RouterView will render a UITabBar.\n\n## Presenting views.\nA view gets presented by setting the navigationTarget to SwiftRouter.Target.new(). \n```Swift\ndispatch(SwiftRouter.Action.add(path: NavPath(\"some path to a route\"), to: .new()))\n```\nTo dismiss it, you simply use the Dismiss action:\n``` Swift\ndispatch(SwiftRouter.Action.Dismiss(navigationModel: The navigationModel to dismiss))\n```\n\n### Alerts\nYou can trigger alerts by dispatching `SwiftRouter.Action.alert`\n```Swift\n    dispatch(\n        SwiftRouter.alert(AlertModel(\n           type: .alert // .alert || .actionSheet, default is .alert\n           label: \"The label of the alert\", // Optional\n           message: \"Optional message\", // Optional\n           buttons: [\n              AlertModelButton(\n                 label: \"the button label\",\n                 action: SomeAction // needs to conform to NavigationActionProvider\n                 type: UIAlertAction.Style = .default\n              )\n           ]\n        ))\n    )\n    \n    extension SomeAction: NavigationActionsProvider {}\n```\n\n### Example app.\nTry the example app `RouterExample` to find out more\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandylindebros%2Fswiftreduxrouter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandylindebros%2Fswiftreduxrouter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandylindebros%2Fswiftreduxrouter/lists"}