iOS SDK
Initialize the SDK with a configuration, identify users, send events, and present flows (paywalls). This page reflects the public API in /Users/levi/dev/nuxie-ios.
Requirements
- iOS 15+
- Swift 5.9+ (Xcode 15+)
Initialization
swift
import Nuxie
var config = NuxieConfiguration(apiKey: "NX_…")
config.environment = .production // .staging, .development, .custom
config.logLevel = .info
do { try NuxieSDK.shared.setup(with: config) }
catch { print("setup failed: \(error)") }Optional user identity and traits:
swift
NuxieSDK.shared.identify(
"user_123",
userProperties: ["plan": "free"],
userPropertiesSetOnce: ["signup_at": Date()]
)Events
swift
// Name + optional properties
NuxieSDK.shared.track("app_opened")
NuxieSDK.shared.track("feature_used", properties: ["feature": "editor"])
// Observe immediate outcomes
NuxieSDK.shared.track("purchase_completed", properties: ["sku": "pro_annual"]) { result in
switch result {
case .noInteraction: break
case .flow(let completion): print(completion.outcome)
case .failed(let error): print(error)
}
}Event names are free‑form; keep them consistent and documented within your team.
Flows (paywalls)
Workflows can present flows automatically. For manual control or debugging:
swift
@MainActor
try await NuxieSDK.shared.showFlow(with: "paywall_summer_launch")
@MainActor
let vc = try await NuxieSDK.shared.getFlowViewController(with: "paywall_summer_launch")
present(vc, animated: true)If you manage purchases, assign a NuxiePurchaseDelegate on NuxieConfiguration.
API Surface (selected)
NuxieSDK.shared.setup(with: NuxieConfiguration)NuxieSDK.shared.identify(_:userProperties:userPropertiesSetOnce:)NuxieSDK.shared.track(_:properties:userProperties:userPropertiesSetOnce:completion:)NuxieSDK.shared.reset(keepAnonymousId:)NuxieSDK.shared.getDistinctId()/isIdentified- Session:
startNewSession(),endSession(),resetSession(),getCurrentSessionId(),setSessionId(_:) - Flows:
showFlow(with:),getFlowViewController(with:) - Queue:
flushEvents(),getQueuedEventCount(),pauseEventQueue(),resumeEventQueue() - Plugins:
installPlugin(_:),uninstallPlugin(_:),startPlugin(_:),stopPlugin(_:),isPluginInstalled(_:)
Configuration (selected)
apiKey: Stringenvironment: .production | .staging | .development | .custom- Logging:
logLevel,enableConsoleLogging,enableFileLogging,redactSensitiveData - Networking/batching:
requestTimeout,retryCount,retryDelay,flushAt,flushInterval,eventBatchSize,maxQueueSize - Hooks:
beforeSend,propertiesSanitizer - Flows cache:
maxFlowCacheSize,flowCacheExpiration,maxConcurrentFlowDownloads,flowDownloadTimeout - Purchases:
purchaseDelegate
Debugging
- Run on a debug build and watch logs for event delivery.
- Manually present a paywall to isolate UI issues from workflow logic.
- Verify the device is in the expected segment before testing a campaign.