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)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 (e.g., for GDPR compliance)
FunnelMob.shared.setEnabled(false)
// Re-enable tracking
FunnelMob.shared.setEnabled(true)
// Force send queued events immediately
FunnelMob.shared.flush()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].