Contents

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"])

βœ… Requirements

  • iOS 13+
  • Swift 5.5+

πŸ“‚ Folder Structure

Sources/
└── SmartDeeplinkKit/
    β”œβ”€β”€ DeepLink.swift
    β”œβ”€β”€ DeepLinkManager.swift
    β”œβ”€β”€ DeepLinkParser.swift
    β”œβ”€β”€ DeepLinkNavigating.swift
    └── Extensions/
        └── URLExtension.swift
Tests/
└── SmartDeeplinkKitTests/
    └── DeepLinkParserTests.swift

App 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.


✨ Author

Made with ❀️ by Rjiosdev(https://github.com/rjiosdev)

Package Metadata

Repository: rjiosdev/smartdeeplinkkit

Default branch: main

README: README.md