TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Jun 2015 |
SPMSupports SPM | ✗ |
Maintained by Ramy Kfoury.
A Swift Router Implementation.
or CocoaPods:
pod 'SwiftMessageBar'
To use the router, first create an instance of it in your AppDelegate class, and then update the following method:
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
return router.routeURL(url)
}
Adding a route requires only a route parameter, and a closure to implement your action
addRoute(yourCustomRoute) { [unowned self] parameters in
// present a view controller or anything you like to do when this route is detected
}
The closure returns to you the parsed parameters, which can be either path parameters or query parameters. Here's an example:
route = scheme://host/path/parameter1/value1?parameter2=value2
parameters = [
"parameter1": "value1"
"parameter2": "value2"
]
To call a route from anywhere in your app:
UIApplication.sharedApplication().openURL(URL)
SwiftRouter is released under the MIT license. See LICENSE for details