Evaluate GrowthBook flags through OpenFeature in Kotlin and Swift
GrowthBook's OpenFeature providers now cover Kotlin and Swift. The Kotlin provider is a new GrowthBookOpenFeature module on Maven Central for Android and the JVM, and the Swift provider is a Swift package for Apple platforms. App code that calls the OpenFeature API can read GrowthBook features through either one.
How the providers work
You register a provider once, and your existing OpenFeature calls then evaluate GrowthBook flags.
- The Kotlin provider creates and manages its own GrowthBook SDK instance from your SDK Connection key and API host.
- On registration, each provider waits up to 10 seconds for the first feature fetch. It is ready immediately when features are already cached.
- Context attributes become GrowthBook attributes, and the OpenFeature targeting key maps to the GrowthBook
idby default. - Evaluations are synchronous and read the global evaluation context. Each call to
setEvaluationContextAndWaitreplaces all attributes.
After registration, a Kotlin flag check looks like any other OpenFeature call:
What still needs the native SDK
Both providers evaluate flags locally. Sticky Bucketing, AI Visual Editor experiments, and inline experiment definitions require the native SDK for your language. The Swift provider throws an error if you configure remoteEval or a sticky bucket service. The Kotlin provider fails to initialize if you configure a sticky bucket service.
Getting started
- Create an SDK Connection key under Settings → SDK Connections.
- Add the provider. On Android or the JVM, add the Gradle artifact
io.growthbook.sdk:GrowthBookOpenFeaturefrom Maven Central, plus a network dispatcher artifact such asNetworkDispatcherOkHttp. On Apple platforms, add theGrowthBookOpenFeatureproduct through Swift Package Manager. - Register the provider with
setProviderAndWaitand an initial context, then evaluate a flag with a default value.
The OpenFeature providers guide has the install snippets, setup code, and configuration options for each language.