Initialization
To create a Wingify Client instance, you need to initialize the Wingify FE iOS SDK. This client instance serves as the core interface for conducting Feature Experimentation(A/B and personalization) within your application.
Usage
import Wingify_FME
// Set SDK Key and Account ID
let options = WingifyInitOptions(accountId: ACCOUNT_ID, sdkKey: SDK_KEY)
// Initialize Wingify SDK
WingifyFme.initialize(options: options) { result in
switch result {
case .success(let message):
// Wingify SDK initialized
case .failure(let error):
// Wingify SDK failed to initialize
}
}The initialize() function is called with the sdkKeyand accountId. It initializes and returns a Wingify Client Object WingifyClient, which can be used to perform feature
This client object allows you to run experiments, track events, and enable/disable feature flags.
Parameter Definitions
| Parameter | Type | Description |
|---|---|---|
| accountId Required | Int | Your Wingify application's Account ID. |
| sdkKey Required | String | A unique environment key is provided to you inside the Websites & Apps section in the Wingify application, under Default Project. |
| logLevel Optional | Enum | The level of logging to be used. For more details, please check - Logger |
| logPrefix Optional | String | A prefix to be added to log messages. For more details, please check - Logger |
| integrations Optional | IntegrationCallback | A callback function that receives data which can be pushed to any external tool that you need to integrate with. For more details, please check - Integrations |
| cachedSettingsExpiryTime Optional | Int64 | Expiry time for cached settings in milliseconds. For more details, please check - Cache Management |
| pollInterval Optional | Int64 | Time (in milliseconds) at which Wingify should check with the server for any updates to the feature flag or rules in the Wingify Dashboard. Useful to keep your Wingify Client instance up-to-date with any changes made in the Wingify Application. For more details, please check -Polling |
| batchMinSize Optional | Int | Minimum size of batch to upload. For more detail, please check - Event Batching |
| batchUploadTimeInterval Optional | Int64 | Batch upload time interval in milliseconds. For more detail, please check - Event Batching |
| logTransport Optional | LogTransport | Protocol to send logs to external systems. For more details, please check - Logger |
Integrations
Wingify SDKs help you integrate with several third-party destinations. SDKs help you integrate with any kind of tool, be it analytics, monitoring, customer data platforms, messaging, etc. by implementing a very basic and generic callback that is capable of receiving Wingify-specific properties.
Example usage:
class MyClass: IntegrationCallback {
func execute(_ properties: [String: Any]) {
// Handle the integration callback here
print("Integration callback executed with properties: \(properties)")
}
}
// Create an instance of your class
let integrationClass = MyClass()
let options = WingifyInitOptions(sdkKey: SDK_KEY, accountId: ACCOUNT_ID, integrations: integrationClass)See Integrations documentation for additional information.
Log Transport
You can implement the LogTransport protocol to customize how logs are handled and sent to external systems
Example usage:
// Define a class that conforms to the LogTransport protocol
class MyClass: LogTransport {
// Implement the log method to handle log messages
func log(logType: String, message: String) {
// Send log to a third-party service or handle it as needed
print("Log Type: \(logType), Message: \(message)")
}
}
// Create an instance of your class
let logClass = MyClass()
// Initialize WingifyInitOptions with the custom log transport
let options = WingifyInitOptions(sdkKey: SDK_KEY, accountId: ACCOUNT_ID, logTransport:logClass)See Logging documentation for additional information.
Polling Interval Adjustment
The pollInterval is an optional parameter that allows the SDK to automatically fetch and update settings from the Wingify server at specified intervals. Setting this parameter ensures your application always uses the latest configuration.
Example usage:
// Initialize WingifyInitOptions with a custom polling interval in milliseconds
let options = WingifyInitOptions(sdkKey: SDK_KEY, accountId: ACCOUNT_ID, pollInterval:600000)See Polling documentation for additional information.
Cached Settings Expiry Time
The cachedSettingsExpiryTime parameter allows you to specify how long the cached settings should be considered valid before fetching new settings from the Wingify server. This helps in managing the freshness of the configuration data.
Example usage:
// Initialize WingifyInitOptions with a custom cached settings expiry time
let options = WingifyInitOptions(sdkKey: SDK_KEY, accountId: ACCOUNT_ID, cachedSettingsExpiryTime:600000)Event Batching Configuration
The Wingify SDK supports storing impression events while the device is offline, ensuring no data loss. These events are batched and seamlessly synchronized with Wingify servers once the device reconnects to the internet. Additionally, online event batching allows synchronization of impression events while the device is online. This feature can be configured by setting either the minimum batch size or the batch upload time interval during SDK initialization.
NOTE: The uploading of events will get triggered based on whichever condition is met first if using both options.
See Event Batching documentation for additional information.
| Parameter | Description | Required | Type | Example |
|---|---|---|---|---|
batchMinSize | Minimum size of the batch to upload. | No | Int | 10 |
batchUploadTimeInterval | Batch upload time interval in milliseconds. Please specify at least a few minutes. | No | Int64 | 300000 |
Example usage:
// Initialize WingifyInitOptions with batch configuration
let options = WingifyInitOptions(sdkKey: SDK_KEY, accountId: ACCOUNT_ID, batchMinSize:10, batchUploadTimeInterval: 300000)Updated 27 days ago