Initialization
Initialize an instance of VWO which will then be used to manage all feature flags and rules. This vwoInstance instance contains all the feature flags and rules that you have configured in your VWO dashboard.
Usage
import VWO_FME
// Set SDK Key and Account ID
let options = VWOInitOptions(accountId: ACCOUNT_ID, sdkKey: SDK_KEY)
// Initialize VWO SDK
VWOFme.initialize(options: options) { result in
switch result {
case .success(let message):
// VWO SDK initialized
case .failure(let error):
// VWO SDK failed to initialize
}
}
As shown above, you need to first initialize the SDK, and set the SDK key and Account ID into options, after which you must call the VWOFme.initialize function with options as an argument.
VWOInitOptions can be used to set additional parameters, of which two are mandatory:
- accountId: This is the unique VWO account ID which you can find on your VWO Dashboard.
- sdkKey: A unique 32-character string corresponding to the project/environment in VWO. You will find this in the Websites & Apps section in VWO, under a "Default Project" for FME.
Parameter Definitions
Besides the two mandatory parameters (accountId and sdkKey), there are some additional optional parameters that can be set using functions on vwInitOptions:
Parameter | Usage | Type | Description |
---|---|---|---|
accountId Required | vwoInitOptions.setAccountId(123); | Number | Your VWO application's Account ID. |
sdkKey Required | vwoInitOptions.setSdkKey("sdk-key"); | String | Unique environment key provided to you inside the Websites & Apps section in VWO application. |
pollInterval Optional | vwoInitOptions.setPollInterval(60); | Number | Time period (in milliseconds) at which VWO should check with the server for any updates to the feature flag or rules in the VWO Dashboard. Useful to keep your vwoClient instance up to date with any changes made in the VWO Application. Polling |
logger Optional | vwoInitOptions.setLogger(logger); | Object | An optional logger object that defines the logging behaviour. Logger |
integrations Optional | vwoInitOptions.setIntegrations(integrations); | Object | Contains a callback function that receives campaign data which can be pushed to any external tool that you need to integrate with. Integrations |
Keeping vwoClient up-to-date
When you initialize the VWO SDK in your mobile application, it pulls the latest configurations you've done in the VWO application.
If/when you make any changes to the feature flags or rules within VWO after the SDK has been initialized in your application, there needs to be some way to update your SDK with the latest settings from VWO. This can be done via polling.
Updated about 1 month ago