Skip to content
Feature flags

iOS SDK

Evaluate feature flags

Read customer-targeted flags synchronously and update host UI when evaluations change.

Read a feature flag

Feature flags load automatically after BTX has a customer identity. Reads are synchronous and use your fallback until the first evaluation is available or when a key is unknown.

Synchronous read
let isEnabled = BTX.featureFlags.isEnabled(
    "settings.messenger-entry.enabled",
    fallback: false
)

Choose a fallback that keeps the host app safe when the network is unavailable or an evaluation has not loaded yet.

01

Update UI when flags change

Subscribe when a view must react after an evaluation, refresh, configuration change, or identity change.

Flag subscription
let featureFlagsCancellable = BTX.featureFlags.onChange { state in
    isMessengerEntryEnabled = state.isEnabled(
        "settings.messenger-entry.enabled",
        fallback: false
    )
}

Retain the returned cancellable for as long as the host state should receive updates.

02

Refresh explicitly

Use an explicit refresh when the product flow needs a current evaluation immediately after an external change.

Refresh
BTX.featureFlags.refresh()