> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trueorigin.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# iOS SDK

> Add TrueOrigin to a native iOS app with Swift Package Manager.

Requirements: iOS 15 or later, Xcode 16 or later. For React Native and Expo, use
[`@trueorigin/react-native`](/sdk/react-native) instead.

## Install

In Xcode: **File → Add Package Dependencies…**, enter

```text theme={null}
https://github.com/trueorigin-dev/trueorigin-ios
```

and choose **Up to Next Major Version** from the latest release. Or in `Package.swift`:

```swift theme={null}
.package(url: "https://github.com/trueorigin-dev/trueorigin-ios", from: "0.1.0")
```

The package is a binary, `TrueOrigin.xcframework`. SwiftPM checks every download against
the checksum in `Package.swift`.

## Configure

Your SDK key is shown when you create the app, and can be rotated in the dashboard under
**Settings → SDK key**. It is a public client key: it ships inside your app.

```swift theme={null}
import TrueOrigin

// as early as possible, e.g. in application(_:didFinishLaunchingWithOptions:)
TrueOrigin.configure(apiKey: "to_…")
```

Only the first call counts. On the first launch after install the SDK reports the install,
then waits for the result. If the device is offline, it retries with exponential backoff
for up to six hours, across launches.

Next: [read the attribution](/sdk/attribution) in your app.

### Options

```swift theme={null}
var options = TrueOrigin.Options()
options.logging = true

TrueOrigin.configure(apiKey: "to_…", options: options)
```

| Option          | Default |                                                                                |
| --------------- | ------- | ------------------------------------------------------------------------------ |
| `logging`       | `false` | Log to the unified logging system, subsystem `dev.trueorigin.sdk`.             |
| `reportTimeout` | 6 hours | How long to keep retrying the first report before the status becomes `failed`. |

`TrueOrigin.installId` is the SDK's id for this install. It stays the same until the app
is deleted; a reinstall gets a new one.

## Universal Links

With Universal Links, a tap on your tracking link opens your app directly when it is
already installed. Without the app, the tap goes to the App Store as usual.

1. In the dashboard, **Settings → App**: enter your **Bundle ID** and **Apple Team ID**.
2. In Xcode, **Signing & Capabilities → Associated Domains**: add
   `applinks:appdownload.link`.

<Warning>
  Apple caches the association file. Save the Bundle ID and Team ID before you ship the
  build that adds the associated domain.
</Warning>

Your app then receives only links under its own link name,
`appdownload.link/{link name}/…`.

## Privacy

The SDK does not read the IDFA or the IDFV. Its only identifier is a random install id
that lives in the app's UserDefaults and is removed with the app. The privacy manifest
(`PrivacyInfo.xcprivacy`) ships inside the framework: no tracking, no tracking domains,
and the required-reason APIs it uses (UserDefaults `CA92.1`, file timestamps `C617.1`).

What your app declares in its App Store privacy label is your decision. What the SDK
sends is listed in our [privacy policy](https://trueorigin.dev/privacy).
