fwr

FWRouter

pure swift router.

Showing:

Popularity

Downloads/wk

0

GitHub Stars

43

Maintenance

Last Commit

3yrs ago

Contributors

2

Package

Dependencies

0

License

MIT

Categories

Readme

FWRouter

Contact Us 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

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.

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, wangjianwei.sir@gmail.com

License

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

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100