rjiosdev/smartdeeplinkkit
A powerful, flexible, and production-ready deep linking library for iOS.
π Features
- β Handles deep links from:
- Universal links (e.g. https://example.com/profile/123) - Push notifications (with custom payload) - Custom schemes (e.g. myapp://settings)
- β
Dynamic path-based routing (
/profile/123,/settings) - β Optional analytics hook and debug logging
- β Supports runtime navigation logic
- β
Fully testable with
XCTest - β Minimal, lightweight, and Swift Package compatible
https://github.com/user-attachments/assets/56eb5467-8cf6-4a44-a7ba-ab3a0b5a7b50
π¦ Installation
CocoaPods
pod 'SmartDeeplinkKit'
Swift Package Manager (SPM)
dependencies: [
.package(url: "https://github.com/yourusername/SmartDeeplinkKit.git", from: "1.0.0")
]Or use Xcode:
- File β Add Packages β
Enter: https://github.com/yourusername/SmartDeeplinkKit.git
π§ Usage
1. Define a NavigationCoordinator that conforms to DeepLinkNavigating
import SwiftUI
import SmartDeeplinkKit
class NavigationCoordinator: ObservableObject, DeepLinkNavigating {
@Published var path = [String]()
nonisolated func navigate(to deepLink: DeepLink) {
print("π¦ Navigating to:", deepLink.path)
let components = deepLink.path.components(separatedBy: "/")
DispatchQueue.main.async {
switch components.first {
case "profile":
if components.count > 1 {
let userID = components[1]
self.path.append("profile/\(userID)")
} else {
self.path.append("profile")
}
case "settings":
self.path.append("settings")
default:
print("β Unhandled path:", deepLink.path)
}
}
}
}2. Initialize and handle deep links
let manager = DeepLinkManager.shared
manager.setNavigator(yourCoordinatorInstance)
manager.setLogging(enabled: true)
manager.setAnalyticsHandler { deepLink in
print("π Tracked:", deepLink)
}3. From URL or Notification
manager.handleURL(URL(string: "https://example.com/profile/123")!)
manager.handleNotificationPayload(["deep_link": "/settings"])π Example Deep Link
https://example.com/profile/123?ref=iosWill result in:
DeepLink(
path: "profile/123",
parameters: ["ref": "ios"]
)β Requirements
- iOS 13+
- Swift 5.5+
π Folder Structure
Sources/
βββ SmartDeeplinkKit/
βββ DeepLink.swift
βββ DeepLinkManager.swift
βββ DeepLinkParser.swift
βββ DeepLinkNavigating.swift
βββ Extensions/
βββ URLExtension.swift
Tests/
βββ SmartDeeplinkKitTests/
βββ DeepLinkParserTests.swiftApp Type Works with SmartDeeplinkKit? How? Pure Swift (UIKit or SwiftUI) β Fully Supported Direct usage Mixed (Swift + Objective-C) β Use in Swift layer Swift handles deep link & calls Obj-C Pure Objective-C β Not directly Needs custom bridging or wrapper
π License
SmartDeeplinkKit is available under the MIT license. See the LICENSE file for more info.
Package Metadata
Repository: rjiosdev/smartdeeplinkkit
Default branch: main
README: README.md