---
title: "Connect with iOS"
description: "Connect a Swift app, show a published Experience, and verify an update without rebuilding the app."
sidebar:
  label: "iOS"
search:
  tags: ["sdk", "setup", "ios"]
  keywords: ["Swift", "StoreKit", "Xcode", "install", "initialize", "integration_test"]
---

The iOS SDK connects your Swift app to Nuxie. Once installed, you can publish Experiences and update their content without rebuilding your app. Requires Xcode 27.1 or later and an iOS 15 or later deployment target.

1. **Installation**

    <span id="install-the-sdk" />

    ## Installation [toc]

    In Xcode, choose **File → Add Package Dependencies** and enter:

    ```text title="Swift package URL"
    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`. For a `Package.swift` project, see [Installation](/docs/ios-sdk/installation).

    <span id="add-your-public-key" />

    ### Public key

    Copy your public app keys from **Connect your app**. Use the `pk_test_` key in Debug and TestFlight builds to load preview content and the `pk_live_` key in App Store builds to load live content. TestFlight purchases are sandbox purchases, which Nuxie accepts only with the test key. Both keys use the SDK's default service environment. Expose the selected key as `NuxieAPIKey` in the target's Info settings.

    For xcconfig-based projects, set `NUXIE_API_KEY` in the appropriate Debug or Release file, then set the Info value to `$(NUXIE_API_KEY)`. The [iOS handoff guide](/integrate/ios#2-put-each-key-in-the-matching-build-configuration) contains the complete configuration steps.

    <span id="configure-at-launch" />

2. **Initialize**

    ## Initialize [toc]

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

    ```swift
    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)
    do {
        try NuxieSDK.shared.setup(with: config)
    } catch {
        // Surface the error during this development integration test.
        assertionFailure("Nuxie setup failed: \(error)")
    }
    ```

    Handle setup errors through your app's launch error handling. [Configuration](/docs/ios-sdk/configuration) covers locale, logging, and purchase options.

    <span id="check-the-connection" />

    Run your app on a device or simulator. **Connect your app** shows **Connected** after Nuxie receives a request from the SDK.

    <span id="prepare-the-experience-you-will-test" />
    <span id="add-a-test-trigger" />

3. **Trigger an Experience**

    ## Trigger an Experience [toc]

    [Publish an Experience](/docs/guides/publishing) for this app with the event trigger `integration_test`. Set its re-entry rule to **Every match** if you want to show it repeatedly while integrating. Add this call to a button handler after setup:

    ```swift
    Button("Show test Experience") {
        NuxieSDK.shared.trigger("integration_test")
    }
    ```

    Tapping the button sends the event. Nuxie displays the Experience when the customer matches its audience and delivery rules. For an existing Experience, replace `integration_test` with its published event name.

    <span id="show-the-experience" />

    **Connect your app** changes to **Shown** after the SDK reports that the Experience appeared.

    <span id="try-a-remote-update" />

4. **Update an Experience**

    ## Update an Experience [toc]

    Edit the Experience and publish your changes. Bring the app back to the foreground to fetch the update, then send the event again with a customer who can re-enter. New Journeys use the updated version; a Journey already in progress keeps the version it started with. The app code stays the same.

    <span id="continue" />

    See the [SDK reference](/docs/reference/ios) for identity, feature access, and App Actions. [Delivery](/docs/guides/delivery) explains trigger and audience configuration.
