Releases: statsig-io/ios-sdk
v1.18.0 - Add macOS support
Adds compatibility with macOS 10.12+
v1.17.1 - Swift 5.5 Build Fix
Fixes an issue with type inference when compiling with Swift 5.5.
v1.17.0 - Adds Layer Overrides
- Add ability to override values returned to getLayer calls.
- Adds inline documentation for the Statsig interface
v1.16.0 - Add methods for checking values without logging exposures
Adds:
checkGateWithExposureLoggingDisabled
andmanuallyLogGateExposure
getExperimentWithExposureLoggingDisabled
andmanuallyLogExperimentExposure
getConfigWithExposureLoggingDisabled
andmanuallyLogConfigExposure
getLayerWithExposureLoggingDisabled
andmanuallyLogLayerParameterExposure
v1.15.0 - Add ability to add StatsigListeners before calling Statsig.start
- Adding a listener via Statsig.addListener before calling Statsig.start will now add the listener in a 'pending' state. Once Statsig.start is called, the listeners will be added to the StatsigClient and all applicable events will be fired.
v1.14.0 - Add StatsigListening Protocol for User Value Changes
Adds the StatsigListening. This protocol allows you to listen for changes in the user value store.
There are two methods that can be implemented:
onInitialized
- Will be called when the initialize request is returned in
Statsig.start()
. - An error string may be passed to this function if something went wrong with the network request.
onUserUpdated
- Will be called when the network request for
Statsig.updateUser
is returned. - An error string may be passed to this function if something went wrong with the network request.
You then add your class that implements StatsigListening as a listener with:
Statsig.addListener(myListeningClass)
Note: If you call Statsig.addListener
after Statsig.start()
is already complete, the onInitialized
method will be called immediately.
Also adds Statsig.isInitialized()
which returns a boolean stating whether the Statsig.start()
call has returned.
These API changes will allow developers to know whether their Statsig instance is initialized.
ViewController Example
class ViewController: UIViewController, StatsigListening {
override func viewDidLoad() {
super.viewDidLoad()
if Statsig.isInitialized() {
render()
} else {
Statsig.addListener(self)
renderLoading()
}
}
private func render() {
var showNewUI = Statsig.checkGate("new_ui_enabled", false)
if showNewUI {
// Render the new
} else {
// Render the old
}
}
private func renderLoading() { /* Some Loading UI */ }
private func renderError(error: String) { /* Some Error UI */ }
// StatsigListening Implementation
func onInitialized(_ error: String?) {
if (error) {
renderError(error)
}
render()
}
func onUserUpdated(_ error: String?) { /* Optional rerender when User changed */ }
}
v1.13.1 - Lower log limit on tvOS
tvOS has far lower size limits for UserDefaults than iOS. Lowering from 1MB to 100KB for tvOS.
v1.13.0 - add support for tvOS
support tvos (#121)
v1.12.0 - Error Boundary
- Adds an error boundary around Statsig logic to prevent exceptions reaching client code and causing a crash. Errors are logged with Statsig to help diagnose problems.
- Refactors some InternalStore logic to remove force unwrapped variables
v1.11.0 - Cancel network request if initTimeout expires
Previously, timing out would just fire the callback early and overwrite Gate/Config/Layers when the initialize request returned. Now, when a timeout occurs, the request is cancelled and only cache or default values will be served.