Skip to content
CodeOnAir
Docs menu

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)
}

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#

  1. Signing & Capabilities → Associated Domains: add applinks:shop.codeonair.com and any custom domain.
  2. Info → URL Types: add your URI scheme, e.g. myapp — in-app browsers use it.
  3. 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")
Stuck? Write to support@codeonair.com with your App ID and what you tried — we reply within a working day.