iOS SDK
iOS SDK - Configuration
Configure the FunnelMob iOS SDK.
Basic Configuration
let config = FunnelMobConfiguration(
apiKey: "fm_live_abc123" // Required: Your API key
)
FunnelMob.shared.initialize(with: config)Full Configuration with Builder
let config = FunnelMobConfiguration(apiKey: "fm_live_abc123")
.with(logLevel: .none) // .none, .error, .warning, .info, .debug, .verbose
.with(flushInterval: 30.0) // Auto-flush interval in seconds (min: 1.0, default: 30.0)
.with(maxBatchSize: 100) // Events per batch (1-100, default: 100)
.with(autoStart: true) // false to defer all activity until start() — see Privacy & Consent
.with(waitForATTAuthorization: false) // true to defer first session until ATT prompt resolvesautoStart and waitForATTAuthorization work with the consent and ATT APIs. See Privacy & Consent for usage patterns.
SwiftUI App
import SwiftUI
import FunnelMob
@main
struct MyApp: App {
init() {
let config = FunnelMobConfiguration(
apiKey: "fm_live_abc123"
)
FunnelMob.shared.initialize(with: config)
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}SDK Control
// Disable tracking (kill switch — for QA / debug; for GDPR use setConsent)
FunnelMob.shared.setEnabled(false)
// Re-enable tracking
FunnelMob.shared.setEnabled(true)
// Force send queued events immediately
FunnelMob.shared.flush()For GDPR / DMA / ATT, see Privacy & Consent — setConsent(...) and requestTrackingAuthorization(...) are the right tools rather than the kill switch.
Error Handling
Errors are logged rather than thrown. Set logLevel to see validation errors:
let config = FunnelMobConfiguration(apiKey: "fm_live_abc123")
.with(logLevel: .debug) // See validation errors in console
FunnelMob.shared.initialize(with: config)Error messages appear in the console with the prefix [FunnelMob].