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:

  1. accountId: This is the unique VWO account ID which you can find on your VWO Dashboard.
  1. 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:

ParameterUsageTypeDescription
accountId
Required
vwoInitOptions.setAccountId(123);NumberYour VWO application's Account ID.
sdkKey
Required
vwoInitOptions.setSdkKey("sdk-key");StringUnique environment key provided to you inside the Websites & Apps section in VWO application.
pollInterval
Optional
vwoInitOptions.setPollInterval(60);NumberTime 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);ObjectAn optional logger object that defines the logging behaviour. Logger
integrations
Optional
vwoInitOptions.setIntegrations(integrations);ObjectContains 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.