Skip to content

Latest commit

 

History

History
83 lines (55 loc) · 1.98 KB

README.md

File metadata and controls

83 lines (55 loc) · 1.98 KB

Routable

build language Platform Version CocoaPods License

迁移至Khala

  1. 安装Khala
    pod 'Khala'
    
  2. 添加路由规则
    // 路由规则
    Khala.language = .cn
    Khala.rewrite.filters.append(RewriteFilter({ (item) -> KhalaURLValue in
        var urlComponents = URLComponents(url: item.url, resolvingAgainstBaseURL: true)
        urlComponents?.host = "Router_" + (item.url.host ?? "")
        urlComponents?.path = "/router_" + item.url.lastPathComponent
        item.url = urlComponents?.url ?? item.url
        return item
    }))
  3. 修改路由函数

    第一个参数修改为匿名.

    from:

    @objc func router_location(params: [String:Any],closure: (_ info: [String:Any]) -> Void){
     	...
    }
    

    to:

    @objc func router_location(_ params: [String:Any],closure: @escaping KhalaClosure){
     	...
    }
  4. 完了.

Require

  • iOS 8.0+ / macOS 10.10+ / tvOS 9.0+ / watchOS 2.0+

  • Swift 4.x

Install

CocoaPod

pod 'SPRoutable'

Useage

  • API Reference - Lastly, please remember to read the full whenever you may need a more detailed reference.

Author

linhay: is.linhay@outlook.com

License

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