After installing the SDK, initialize VWO Insights in your AppDelegate file by following the steps below:
Step 1: Import the SDK
import VWO_Insights
Step 2: Initialize the SDK
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
VWO.configure(
accountId: "<YOUR_ACCOUNT_ID>",
sdkKey: "<YOUR_SDK_KEY>",
isSwiftUI: true, // Set to true if your app supports SwiftUI
userId: "<USER_ID>" // Optional: Pass a unique identifier if available
) { result in
switch result {
case .success(_):
print("VWO launched successfully")
VWO.startSessionRecording()
case .failure(let error):
print("VWO launch failed: \(error)")
}
}
return true
}
Parameter Notes
- isSwiftUI → Set this to true if your app supports SwiftUI.
- userId → Optional parameter; use it if you have a logged-in user or unique identifier.