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.
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.
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.
BTX.featureFlags.refresh()