---
title: "Integrate Nuxie with iOS"
description: "Add the iOS SDK and show the Experience you published."
search:
  tags: ["sdk", "ios", "setup"]
  keywords: ["Swift", "Debug builds", "Release builds", "NuxieAPIKey"]
---

Use this guide with the setup prompt copied from **Connect your app**. It contains the keys for your builds and, after publishing, the Experience name and exact trigger event. You'll install the SDK, call that trigger from the relevant app action, and see the published Experience on a device or simulator.

Requires Xcode 27.1 or later and an iOS 15 or later deployment target. If you haven't published an Experience yet, follow [Integrate your app](/docs/get-started/quickstart) first.

1. **Install the SDK**

    ## 1. Install the SDK [toc]

    Add the Swift package in **File → Add Package Dependencies**, then select the **Nuxie** product for your app target:

    ```text
    https://github.com/nuxieai/nuxie-ios
    ```

    Set **Dependency Rule** to **Up to Next Major Version**, starting at `1.0.0`, and add the **Nuxie** product to your app target. Xcode records the resolved revision in `Package.resolved`.

    Build the target with this import:

    ```swift
    // nuxie-doc-snippet: import-nuxie
    import Nuxie
    ```

2. **Put each key in the matching build configuration**

    ## 2. Put each key in the matching build configuration [toc]

    Use your app's existing configuration system. For xcconfig-based projects:

    ```text title="Config/Debug.xcconfig"
    NUXIE_API_KEY = <API_KEY_DEBUG_BUILDS>
    ```

    ```text title="Config/Release.xcconfig"
    NUXIE_API_KEY = <API_KEY_RELEASE_BUILDS>
    ```

    Assign the files to the matching Xcode build configurations. If xcconfig files already exist, add the setting to them.

    Add a `NuxieAPIKey` entry in the target's Info settings with the value `$(NUXIE_API_KEY)`. The **Debug builds** key starts with `pk_test_` and receives preview versions. The **Release builds** key starts with `pk_live_` and receives production versions. Use these publishable app keys, never workspace API keys.

    TestFlight builds use a Release configuration, but their purchases are App Store sandbox purchases, which Nuxie accepts only with the `pk_test_` key. Build the uploads you test in TestFlight with the test key, for example from a separate build configuration, and keep the live key for the build you release on the App Store.

3. **Configure Nuxie at app launch**

    ## 3. Configure Nuxie at app launch [toc]

    Call setup once in the SwiftUI `App` initializer or UIKit app delegate:

    ```swift
    // nuxie-doc-snippet: configure-nuxie-from-bundle
    import Foundation
    import Nuxie

    guard
        let apiKey = Bundle.main.object(forInfoDictionaryKey: "NuxieAPIKey") as? String,
        !apiKey.isEmpty
    else {
        preconditionFailure("Missing NuxieAPIKey build setting")
    }

    let config = NuxieConfiguration(apiKey: apiKey)
    try NuxieSDK.shared.setup(with: config)
    ```

    Handle setup errors using your app's launch error handling.

    Leave `config.environment` at its default for every build, including Debug and TestFlight builds. The key alone selects test or live content, and purchases are matched to customers by that key.

    <span id="purchase-actions-only" />

    ### Configure purchases

    Native StoreKit requires no extra configuration. If your app already uses a purchase provider, configure its delegate and select observer mode when the provider finishes transactions:

    ```swift
    // nuxie-doc-fragment: configure-app-purchase-delegate harness=app-delegate-body
    let config = NuxieConfiguration(apiKey: apiKey)
    config.purchaseHandlingMode = .observer
    config.purchaseDelegate = AppPurchaseDelegate.shared
    try NuxieSDK.shared.setup(with: config)
    ```

    The delegate opens checkout with the supplied `StoreProduct` and returns the purchase or restore outcome. See [Purchases](/docs/ios-sdk/purchases) for native, RevenueCat, and Superwall examples.

4. **Wire the published trigger**

    ## 4. Wire the published trigger [toc]

    ```swift
    // nuxie-doc-fragment: trigger-authored-event harness=sync-body
    NuxieSDK.shared.trigger("<TRIGGER_EVENT>")
    ```

    Replace the placeholder with the exact event in the handoff. Call it from the intended user action after setup, such as an upgrade button's tap handler.

    <span id="first-launch-onboarding" />

    ### Show onboarding at first launch

    To show an onboarding and paywall only to people who don't have access yet, check the Feature at launch and send the trigger only when it isn't allowed:

    ```swift
    // nuxie-doc-fragment: trigger-onboarding-without-access harness=async-body
    let access = try await NuxieSDK.shared.hasFeature("<FEATURE_KEY>")
    if !access.allowed {
        NuxieSDK.shared.trigger("<TRIGGER_EVENT>")
    }
    ```

    Run it once per launch, after setup and after `identify()` when your app restores a signed-in account, so Nuxie checks the right customer. Set the Experience's **Re-entry** to **One time** so it appears only the first time. Someone who already has access, such as after buying on another device, never sees it. If the check throws, for example offline, skip the trigger and try again at the next launch.

5. **Verify on a device or simulator**

    ## 5. Verify on a device or simulator [toc]

    Run the app and open **Connect your app** in Nuxie. The status changes to **Connected** when the SDK connects. Perform the app action that sends the trigger; the published screen should appear and the status should show **Shown**. Complete or dismiss the Experience to finish the run.

    To try the paywall without StoreKit, set `testStoreEnabled = true` in Debug builds: Nuxie's [Test Store](/docs/ios-sdk/configuration#test-store) completes the purchase without a charge and unlocks the Feature.

    If the screen does not appear, check the app key, event name, audience, and re-entry rules. See [Presenting Experiences](/docs/ios-sdk/presenting-experiences#if-the-experience-does-not-appear).

<span id="completion-report" />

## Confirm the integration

If you're using a coding agent, ask it to summarize where it added configuration and the trigger, which purchase integration it used, and what it verified on the device. This makes it easy to review the changes before releasing your app.

<span id="next-steps" />

Continue with [customer identity](/docs/ios-sdk/identity-and-users) or [purchase verification](/docs/monetization/verify-ios-purchases).
