Connect with iOS
Connect a Swift app, show a published Experience, and verify an update without rebuilding the app.
The iOS SDK connects your Swift app to Nuxie. Once installed, you can publish Experiences and update their content without rebuilding your app. Requires iOS 15+ and Swift tools 5.9+.
Installation
Installation
In Xcode, choose File → Add Package Dependencies and enter:
https://github.com/nuxieai/nuxie-iosAdd the Nuxie product to your app target. For a Package.swift project, see Installation.
Public key
Copy your public app keys from Connect your app. Use the pk_test_ key in Debug builds to load preview content and the pk_live_ key in Release builds to load live content. Both 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 contains the complete configuration steps.
Initialize
Initialize
Call setup once in your SwiftUI App initializer or UIKit app delegate:
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 covers locale, logging, and purchase options.
Run your app on a device or simulator. Connect your app shows Connected after Nuxie receives a request from the SDK.
Trigger an Experience
Trigger an Experience
Publish an Experience for this app with the event trigger integration_test. Set its re-entry rule to Every time if you want to show it repeatedly while integrating. Add this call to a button handler after setup:
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.
Connect your app changes to Shown after the SDK reports that the Experience appeared.
Update an Experience
Update an Experience
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.
See the SDK reference for identity, feature access, and App Actions. Delivery explains trigger and audience configuration.