Skip to main content
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 in Package.swift:
Then add the 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

Call initialize(with:) once, as early as your app starts. It stores the configuration and calls the server in the background; nothing waits on it.
In async code the same call returns the resulting state:
A second call is ignored. Every ads request made before initialization finishes simply waits for it, so you can create a 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

Use 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)

Add NSUserTrackingUsageDescription to Info.plist:
The Video SDK does not show the ATT dialog by default: a video app usually has its own moment for it. Request it yourself, or set 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, to Info.plist:
Without Kontext’s identifier, installs from directly-served campaigns silently won’t be attributed. See SKAdNetwork for the full guide. If your app runs a TCF-compliant consent platform, the SDK reads the IAB consent keys it writes to UserDefaults on every request; nothing to do. COPPA cannot be read from the device, so set it yourself:
See TCF & CMP.