iOS SDK Setup
Add CodeOnAir AppLinks to a native iOS app in Swift or SwiftUI: Swift Package Manager or CocoaPods, App ID, Associated Domains and deferred links.
The iOS SDK (CodeOnAirDeepLink) supports iOS 15+, installs with Swift Package Manager or CocoaPods, ships a privacy manifest and never reads the IDFA.
1. Install#
Xcode → File → Add Package Dependencies → enter https://github.com/codeonair/deeplink-ios and add the CodeOnAirDeepLink library to your app target. Or with CocoaPods:
Podfile
pod 'CodeOnAirDeepLink', '~> 1.0'
2. Add your App ID#
Info.plist
<key>CodeOnAirAppId</key> <string>proj_…</string>
3. Initialize and listen#
AppDelegate.swift — application(_:didFinishLaunchingWithOptions:)
import CodeOnAirDeepLink
DeepLink.initialize() // reads CodeOnAirAppId from Info.plist
DeepLink.onLink { link in
// link.path, link.params, link.isDeferred, link.matchMethod
Router.open(link.path, params: link.params)
}4. Pass links to the SDK#
UIKit (SceneDelegate)
SceneDelegate.swift
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
DeepLink.handle(userActivity) // Universal Links
}
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
URLContexts.forEach { DeepLink.handle(url: $0.url) } // URI scheme
}SwiftUI
App.swift
WindowGroup { ContentView() }
.onOpenURL { DeepLink.handle(url: $0) }
.onContinueUserActivity(NSUserActivityTypeBrowsingWeb) { DeepLink.handle($0) }5. Capabilities#
- Signing & Capabilities → Associated Domains: add
applinks:shop.codeonair.comand any custom domain. - Info → URL Types: add your URI scheme, e.g.
myapp— in-app browsers use it. - Optional, exact iOS installs: turn on Advanced deferred deep link in the URL prefix's App info and pass
DeepLinkConfiguration(clipboardMatching: true). iOS shows a paste prompt on first launch.
Tip
Universal Links don't open from the address bar or from a link on the same domain. Test by tapping the link in Notes or Messages.
More calls#
let url = try await DeepLink.createLink(LinkOptions(path: "/p/1", params: ["ref": "share"]))
DeepLink.trackEvent("purchase", data: ["amount": 499])
DeepLink.setUserId("user-123")