Configuration
Initialize the SDK with your API key and environment settings
Configuration
Initialize the SDK at app launch with your API key and configuration options. Call setup(with:) once, as early as possible -- typically in your AppDelegate.application(_:didFinishLaunchingWithOptions:) or your SwiftUI App.init().
Minimal setup
import Nuxie
let config = NuxieConfiguration(apiKey: "your_api_key")
try NuxieSDK.shared.setup(with: config)Find your API key in the Nuxie dashboard under Settings > API Keys.
The SDK is ready to use after setup(with:) returns. Behind the scenes, it starts asynchronous tasks to fetch your profile, initialize the event system, and begin listening for StoreKit transactions.
Full setup example
import Nuxie
let config = NuxieConfiguration(apiKey: "your_api_key")
// Environment
config.environment = .production
// Logging
config.logLevel = .debug
config.enableConsoleLogging = true
config.redactSensitiveData = true
// Event batching
config.flushAt = 20
config.flushInterval = 30
config.maxQueueSize = 1000
// Identity
config.eventLinkingPolicy = .migrateOnIdentify
// Locale override
config.localeIdentifier = "es_ES"
// Privacy
config.propertiesSanitizer = DefaultPropertiesSanitizers.privacy
config.beforeSend = { event in
// Drop internal debug events
if event.name.hasPrefix("debug_") { return nil }
return event
}
// Purchases
config.purchaseDelegate = MyPurchaseDelegate()
try NuxieSDK.shared.setup(with: config)Configuration options
Core
Environments
Logging
Event batching
Identity
Locale
Privacy
Purchases
Plugins
Setup behavior
When you call setup(with:), the SDK performs these steps synchronously:
- Validates the API key.
- Registers the configuration.
- Configures the logger.
- Starts the app lifecycle coordinator.
- Installs and starts plugins (if enabled).
It also launches background tasks for:
- Initializing the event storage and network queue.
- Restoring persisted campaign journeys.
- Fetching the initial profile from the edge.
- Syncing feature access to the SwiftUI observable.
- Listening for StoreKit 2 transaction updates.
Tip:
setup(with:)is intentionally one-shot. Calling it a second time logs a warning and returns without reconfiguring. If you need to change configuration, restart the app with the new settings.
Next steps
- Identity & Users -- identify users and manage login/logout
- Tracking Events -- send events to power campaigns and analytics
- Presenting Flows -- show paywalls and screens in your app