Latest 0.1.0-rc2
Homepage https://github.com/JianweiWangs/FWRouter
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform
codecov

中文版本请查看这里

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.

Example

To run the example project, clone the repo, and run make from the root directory first.

There are 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.

Usage

URL Match

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")

Path Parameter

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")

Parameter

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"]
)

Requirements

This library requires iOS 8.0+, Xcode 9.0+ and Swift 4.0+.

Installation

FWRouter is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'FWRouter'

Author

JianweiWangs, [email protected]

License

FWRouter is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "FWRouter",
    "version": "0.1.0-rc2",
    "summary": "ud83dude8d High-performance trie-node router.",
    "description": "FWRouter is a High-performance trie-node router.",
    "homepage": "https://github.com/JianweiWangs/FWRouter",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "JianweiWangs": "[email protected]"
    },
    "source": {
        "git": "https://github.com/JianweiWangs/FWRouter.git",
        "tag": "0.1.0-rc2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "swift_version": "4.2",
    "source_files": "FWRouter/Classes/**/*"
}

Pin It on Pinterest

Share This