Swiftpack.co - shotastage/DeepLinkRouter.swift as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by shotastage.
shotastage/DeepLinkRouter.swift 0.0.3
Super minimum deep link router for Swift.
⭐️ 1
🕓 2 years ago
.package(url: "https://github.com/shotastage/DeepLinkRouter.swift.git", from: "0.0.3")

DeepLinkRouter

Build Status Carthage compatible Version Swift License Platform

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.

GitHub

link
Stars: 1
Last commit: 10 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Introduce new router syntax
5 years ago

See changelog for detail.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics