iOS SDK Initialization
Initialize VLPlay SDK as early as possible in your app lifecycle. [PLACEHOLDER] For UIKit apps, initialize in AppDelegate.application(_:didFinishLaunchingWithOptions:). For SwiftUI apps, use the @main App struct's initializer or a dedicated initialization task.
[PLACEHOLDER] The SDK supports Swift concurrency (async/await) throughout its API. The initialize() call is synchronous, but feature calls such as auth.login() and purchase.buy() are async and should be awaited.
UIKit
AppDelegate.swift
import UIKit
import VLPlaySDK
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
VLPlaySDK.initialize(
appId: "YOUR_APP_ID",
clientSecret: "YOUR_CLIENT_SECRET",
environment: .production
)
return true
}
// Handle OAuth callback URL
func application(
_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any] = [:]
) -> Bool {
return VLPlaySDK.handleOpenURL(url)
}
}
SwiftUI
MyGameApp.swift
import SwiftUI
import VLPlaySDK
@main
struct MyGameApp: App {
init() {
VLPlaySDK.initialize(
appId: "YOUR_APP_ID",
clientSecret: "YOUR_CLIENT_SECRET"
)
}
var body: some Scene {
WindowGroup {
ContentView()
.onOpenURL { url in
VLPlaySDK.handleOpenURL(url)
}
}
}
}
Verify
print("VLPlay SDK version: \(VLPlaySDK.version)")
print("Initialized: \(VLPlaySDK.isInitialized)")