You’ll need a publisher account to obtain your
publisherToken.1. Add the SDK
Add the package as a dependency in Xcode (File → Add Package Dependencies) or inPackage.swift:
KontextVideoSDK product to your app target.
The SDK depends on KontextKit, shared iOS primitives (install id, device info, ATT, consent). Swift Package Manager pulls it in for you.
2. Initialize at launch
Callinitialize(with:) once, as early as your app starts. It stores the configuration and calls the server in the background; nothing waits on it.
async code the same call returns the resulting state:
VideoAds right away.
KontextVideo, VideoAds and VideoAd are @MainActor. Call them from the main actor, which is the default in SwiftUI views and in @MainActor-isolated view controllers.Configuration
logLevel: .debug while integrating; it logs every request, every ad and every beacon to the console under the subsystem so.kontext.video.
3. Set up IDFA (App Tracking Transparency)
AddNSUserTrackingUsageDescription to Info.plist:
requestTrackingAuthorization: true and the SDK asks right before its first ads request. Either way the SDK reads the IDFA once the viewer allowed it.
See IFA & ATT for the Info.plist key, prompt-timing gotchas, and how to manage the prompt yourself.
4. Set up SKAdNetwork
Add Kontext’s ad network identifier, plus the DSP identifiers we provide during onboarding, toInfo.plist:
5. Consent
If your app runs a TCF-compliant consent platform, the SDK reads the IAB consent keys it writes toUserDefaults on every request; nothing to do. COPPA cannot be read from the device, so set it yourself: