中文版本请查看这里
FWRouter is a High-performance trie-node router, idea from Vapor/routing
This is not a Server router, but an iOS UI Router, You can build your own iOS app from it.
use
git clone https://github.com/JianweiWangs/FWRouter.git cd FWRouter make to fetch and build source code quickly.
There are also some script help you develop and PR.
# install dependence and open project make # install dependence make install # build test make test # open project make open # quit Xcode make quit Before you pull request, make sure test success.
let router = FWRouterManager.shared.router // url match route.match("scheme://host/path") { (target) -> Bool in let demoVC = DemoViewController() target.navigation?.pushViewController(demoVC, animated: true) return true } route.route(url: "scheme://host/path")router.match("scheme://host", "parameter", String.parameter, use: { (target) -> Bool in print(target.url) // scheme://host/parameter/param0 print(target.pathParamters.next(String.self)) // "param0" return true }) router.route(url: "scheme://host/parameter/param0")router.match("scheme://host/path", "/thridParameter", use: { (target) -> Bool in print(target.parameters["name"] as? String) //"wangjianwei" return true }) router.route( url: "scheme://host/path/thridParameter", parameters: ["name": "wangjianwei"] )This library requires iOS 8.0+, Xcode 9.0+ and Swift 4.0+.
FWRouter is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'FWRouter'JianweiWangs, wangjianwei.sir@gmail.com
FWRouter is available under the MIT license. See the LICENSE file for more info.