Latest 0.0.1
License MIT
Platforms ios 8.0

ZBJCalendar GitHub license Cocoapods

URLRouter is a url manager based regular expressions, it is inspired by URLNavigator. But i don’t like the URLMatcher in URLNavigator. I like regular expressions which is smaller but stronger.

Thanks devxoul for the excellent projects he opend.


  • iOS 8 or later

Installation with CocoaPods

pod 'URLRouter'

Installation with Carthage

github "wanggang316/URLRouter"



  • Registe a class which is implements the URLRoutable protocol"abc://page/city/\d+\?name=\w+", routable: CityViewController.self)"abc://page/user/\d+", routable: UserViewController.self)
  • Registe a handler closure"tel:[^\s]+", handler: { (url) in!)
    return true
})"abc://alert\?title=\w+&message=\w+", handler: { (url) in

    let params = url.urlValue?.queryParameters
    let title = params?["title"]
    let message = params?["message"]

    let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
    alert.addAction(UIAlertAction(title: "Yes", style: .cancel, handler: nil))

    let appdelegate = UIApplication.shared.delegate as? AppDelegate
    appdelegate?.window?.rootViewController?.present(alert, animated: true, completion: nil)

    return true

Handle url

  • handler via push or present action
URLRouter.default.push(url, from: self.navigationController!)
  • handle via the closure


URLRouter is released under the MIT license.

Latest podspec

    "name": "URLRouter",
    "version": "0.0.1",
    "summary": "A lightweight swift URL manager based regular expressions.",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "gump": "[email protected]"
    "social_media_url": "",
    "platforms": {
        "ios": "8.0"
    "source": {
        "git": "",
        "tag": "0.0.1"
    "source_files": "URLRouter/URLRouter/*.swift",
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This