iOS SDK API Reference
Complete Swift API reference for VLPlay SDK for iOS. [PLACEHOLDER] The SDK uses Swift concurrency (async/await) throughout. All async methods are marked with async throws and should be called within a Task or async context. Objective-C compatibility headers are included for mixed-language projects.
[PLACEHOLDER] UI-presenting methods (auth.login, support.show) require a UIViewController parameter on UIKit, or are presented automatically using SwiftUI's environment on SwiftUI. On SwiftUI, use the .vlplaySupport() view modifier to enable automatic presentation.
VLPlaySDK
initialize(appId:clientSecret:environment:logLevel:)
static func initialize(
appId: String,
clientSecret: String,
environment: VLPlayEnvironment = .production,
logLevel: VLPlayLogLevel = .none
)
version: String
SDK version string.
isInitialized: Bool
Returns true after successful initialization.
handleOpenURL(_ url: URL) -> Bool
Pass URL to the SDK from AppDelegate or .onOpenURL. Required for OAuth callback.
auth
auth.login(from:) async throws -> VLPlayUser
func login(from viewController: UIViewController) async throws -> VLPlayUser
auth.logout() async
Log out and clear the session.
auth.currentUser: VLPlayUser?
The currently authenticated user.
auth.onAuthStateChanged(_ handler: @escaping (VLPlayUser?) -> Void) -> AnyCancellable
Subscribe to auth state changes using Combine.
iap
iap.getProducts(ids:) async throws -> [VLPlayProduct]
Fetch App Store product details.
iap.purchase(productId:) async throws -> VLPlayPurchase
struct VLPlayPurchase {
let transactionId: String
let productId: String
let verified: Bool
}
analytics
analytics.track(event:properties:)
func track(event: String, properties: [String: Any] = [:])
analytics.setUserProperties(_ properties: [String: Any])
Set persistent user-level properties.
support
support.show(from:)
func show(from viewController: UIViewController)
support.getUnreadCount() async -> Int
Returns unread support message count.