FunnelMob

iOS SDK

iOS SDK - Remote Config

Read remote config values with the FunnelMob iOS SDK.

Remote Config lets you change values in your app without shipping a new build. Define keys in the FunnelMob dashboard (under Feature Management → Remote Config), and read them from the SDK at runtime to flip features on or off, tune values, or roll out experiments.

The SDK fetches config automatically during initialize(with:), caches the result for 5 minutes in UserDefaults, and exposes synchronous getters that work even before the network call completes (using cached or default values).

Reading values

// Untyped — returns Any?
let raw = FunnelMob.shared.getConfig("welcome_message")
 
// Typed with a default — returns the default if the key is missing or the type doesn't match
let message: String = FunnelMob.shared.getConfig("welcome_message", default: "Welcome!")
let maxRetries: Int = FunnelMob.shared.getConfig("max_retry_attempts", default: 3)
let darkMode: Bool = FunnelMob.shared.getConfig("dark_mode_default", default: false)
 
// Get everything at once
let all = FunnelMob.shared.getAllConfig()

The typed overload is the recommended way to read values — it gives you compile-time type safety and a guaranteed fallback if the key isn't set or the dashboard value is the wrong type.

Reacting when config loads

If you need to react the first time config arrives (for example, to render a paywall whose copy is configured remotely), register a callback:

FunnelMob.shared.onConfigLoaded { config in
    // config: [String: Any] — full snapshot
    let theme = FunnelMob.shared.getConfig("theme", default: "light")
    applyTheme(theme)
}

The callback fires immediately if config is already loaded (e.g. from cache), so you don't need to special-case the "already loaded" path.

Caching behavior

LayerWhereTTL
In-memorySingleton stateProcess lifetime
DiskUserDefaults (com.funnelmob.config)5 minutes
ServerRedis (transparent to SDK)Invalidated on dashboard edits

On launch the SDK loads the cached snapshot synchronously, then fetches the latest in the background. Dashboard edits invalidate the server-side cache instantly, but devices may take up to 5 minutes to pick up changes because of the local cache.

Supported value types

Set values in the dashboard as one of: string, number, boolean, or json. The SDK preserves these types — read them back as String, Int/Double, Bool, or [String: Any] / [Any] respectively.

// JSON values come back as [String: Any]
if let flags = FunnelMob.shared.getConfig("feature_flags") as? [String: Any] {
    let aiEnabled = flags["ai_insights"] as? Bool ?? false
}

Common patterns

Feature flags

if FunnelMob.shared.getConfig("new_checkout_enabled", default: false) {
    showNewCheckout()
} else {
    showLegacyCheckout()
}

Tuning values without a release

let timeoutMs: Int = FunnelMob.shared.getConfig("api_timeout_ms", default: 30_000)
URLSession.shared.configuration.timeoutIntervalForRequest = TimeInterval(timeoutMs) / 1000

Server-driven copy

welcomeLabel.text = FunnelMob.shared.getConfig("welcome_message", default: "Welcome!")