Rename routing to router
A lightweight routing system written in Swift.
let router = Router<Void>(schemes: ["ditto"]) let endpoint = Endpoint(url: URL(string: "ditto://foo/:bar")!) let route = Route<Void>(endpoint: endpoint) { context in guard let bar: Int = try? context.argument(forKey: "bar") else { return false } print(bar) // 233 return true } router.register(route) let url = URL(string: "ditto://foo/233")! if router.responds(to: url) { router.route(to: url) }
class Router { // Register home page route use silgen prefix `ditto:` // alligator://home // https://www.alligator.com/home @_silgen_name("ditto:/home") func home(context: Context<RoutingCoordinator>) -> Bool { return true } }
Ditto is available under the MIT License. See the LICENSE file for more info.
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
Ditto
A lightweight routing system written in Swift.
Usage
Advanced
License
Ditto is available under the MIT License. See the LICENSE file for more info.