GrowthBook's Swift and Kotlin SDK changes add typed helpers for feature values, with defaults chosen in application code. Swift uses an explicit type argument. Kotlin's companion module keeps a feature key and default together. The fallback rules differ by API.
Choose values and defaults
Use the helper that matches the value your application expects:
- Swift's getFeatureValue(feature:as:default:) adds an explicit as: label. The Int overload returns your default when integer conversion is unavailable. The existing JSON-returning getter remains.
- Kotlin's GrowthBookExt module adds Flag<T> declarations and value(flag). Supported defaults are Boolean, String, Int, Long, Float, and Double. Other types throw.
A Kotlin flag's default covers missing or unreadable values. The separate FAIL_OPEN and FAIL_CLOSED policies apply only to unknown features. Before the first payload loads, a feature may be unknown, so choose startup behavior deliberately.
Decode Kotlin configuration models
For custom Kotlin models, decodeAs<T>() uses the optional GrowthBookKotlinxSerialization module. Its default decoder ignores unknown fields, and you can supply custom Json settings.
Caught decoding exceptions return null, so handle that result in your application. Serialization happens before that catch.
Getting started
Compare the helper signatures with your installed SDK before changing feature reads. Check the expected value type and fallback for one feature, including its behavior before definitions load. Review the Swift SDK setup or Kotlin serialization guide.