DeepLinkRouter
DeepLinkRouter is deep link manager for Swift.
Installation
CocoaPods
pod 'DeepLinkRouter'
Carthage
github "shotastage/DeepLinkRouter" "0.0.3"
Basic Usage
First, import DeepLinkRouter.
THen, override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey :Any] = [:]) -> Bool
and register host & path like below.
URL: your-app://host/path
Example
your-app://next/movie
import UIKit
import DeepLinkRouter
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
...
func application(_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
let router = Router(from: url)
router
.register(path: "next/movie", {
NSLog("LOG: Movie action has been launched!")
})
.register(path: "next/photo", {
NSLog("LOG: Photo action has been launched!")
})
.register(path: "next/music", {
NSLog("LOG: Music action has been launched!")
})
.performRouter()
return true
}
...
}
License
This software is freely distributed under the MIT, see LICENSE for detail.