DeepLinkNow iOS SDK
DeepLinkNow iOS SDK provides robust deep linking and attribution capabilities for iOS applications. The SDK enables seamless handling of deep links, deferred deep links, and user attribution tracking.
Requirements
- iOS 13.0+
- Swift 5.0+
- Xcode 13.0+
Installation
Install via CocoaPods or Swift Package Manager:
CocoaPods
Add this to your Podfile:
pod 'DeepLinkNow'
Swift Package Manager
Add the package in Xcode: - File > Swift Packages > Add Package Dependency - Enter package URL: https://github.com/deeplinknow/ios-sdk.git
Getting Started
Initialize the SDK in your AppDelegate:
Deep Linking
The SDK provides comprehensive deep linking capabilities.
Creating Deep Links
Create deep links with custom parameters:
var customParams = DLNCustomParameters()
customParams["referrer"] = "social_share"
customParams["is_promo"] = true
customParams["discount"] = 20
let deepLink = DeepLinkNow.createDeepLink(
path: "/product/123",
customParameters: customParams
)
Handling Deep Links
Register and handle deep links with the router:
let router = DLNRouter()
router.register(pattern: "product/:id") { url, params in
if let parsed = DeepLinkNow.parseDeepLink(url) {
// Access route parameters
let productId = params["id"]
// Access custom parameters
let referrer = parsed.parameters.string("referrer")
let isPromo = parsed.parameters.bool("is_promo") ?? false
let discount = parsed.parameters.int("discount")
// Handle the deep link
navigateToProduct(
id: productId,
referrer: referrer,
isPromo: isPromo,
discount: discount
)
}
}
Deferred Deep Linking
Check for deferred deep links during app launch:
Device Fingerprinting
The SDK automatically collects device information for attribution:
Custom Parameters
The DLNCustomParameters struct provides type-safe access to parameters:
Error Handling
The SDK provides specific error types:
Universal Links
Configure Universal Links in your app:
Configuration
1. Add Associated Domains capability 2. Add domain to entitlements:
applinks:your-domain.com
Handling
Handle Universal Links in your app delegate:
func application(_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
if userActivity.activityType == NSUserActivityTypeBrowsingWeb,
let url = userActivity.webpageURL {
return DeepLinkNow.handleUniversalLink(url)
}
return false
}
Best Practices
Follow these best practices for optimal SDK usage:
Early Initialization
Initialize the SDK in application(_:didFinishLaunchingWithOptions:)
Error Handling
Implement proper error handling for SDK operations
Type Safety
Use the provided type-safe methods when accessing parameters
Testing
Test deep links in various scenarios (cold/warm launch)