Skip to content
Dashboard

Installation

Detour provides a native iOS SDK (Detour) for deferred links, Universal Links, and custom scheme links.

A Detour app in the Dashboard is required before the SDK can resolve links. See Getting Started.

  • iOS 13+
  • Swift 5.5+

In Xcode:

  1. Open your project.
  2. Go to File > Add Package Dependencies...
  3. Enter repository URL:
    • https://github.com/software-mansion-labs/ios-detour
  4. Add product Detour to your app target.

Or in Package.swift:

Package.swift
.package(url: "https://github.com/software-mansion-labs/ios-detour", from: "1.1.1")

In your Podfile:

Podfile
platform :ios, '13.0'
target 'YourAppTarget' do
use_frameworks!
pod 'Detour', '1.1.1'
end

Then run:

Terminal window
pod install

Both values come from API configuration in the Dashboard: the appID and the publishable apiKey. See Getting Started.

import Detour
let detourConfig = DetourConfig(
apiKey: "<YOUR_DETOUR_API_KEY>",
appID: "<YOUR_DETOUR_APP_ID>",
shouldUseClipboard: true,
linkProcessingMode: .all
)

Keep apiKey and appID in a build configuration file or another secure configuration layer rather than hard-coded in source.

In Xcode, open your app target, select Signing & Capabilities, add the Associated Domains capability, and enter applinks:<your-domain>. Use the domain generated in App configuration in the Dashboard.

The resulting entry in your app’s entitlements file is:

<App>.entitlements
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:<your-domain></string>
</array>

Without this capability, iOS does not dispatch Detour Universal Links to your app.

If your app is served from a custom domain, the Dashboard generates this entry for that domain. Assign the domain before you copy the entry. Changing the host an app is assigned to later needs a new build.

Custom schemes are not generated by the Dashboard. Add your scheme in Xcode under the app target’s Info → URL Types, or add the equivalent entry to Info.plist:

Info.plist
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>myapp</string>
</array>
</dict>
</array>

Without this entry, iOS does not dispatch myapp://... links to your app. The startup and runtime callbacks for both link types are covered in Usage.

From 1.1.1 the package bundles a PrivacyInfo.xcprivacy manifest, copied into your app by both Swift Package Manager and CocoaPods. There is nothing to configure. You still need to answer the App Store Connect privacy questionnaire for what Detour collects. The answers are listed in Privacy.

  1. Wire startup and runtime handling in Usage.
  2. Run the template app in Examples.