iOS SDK
Swift Package Manager, XCFramework distribution, and native UIKit/SwiftUI support.
I want to set up Koah's iOS SDK. Read https://docs.koahlabs.com/SKILL.md and follow its instructions.
Koah 1.1.0 is stable and live on Swift Package Manager — use the stable version range shown below. Upgrading from 0.x? Follow the migration guide. Questions: support@koahlabs.com.
Prerequisites
- iOS: 13.0+
- Swift: 6.0+
- Xcode: 16.0+
- A Koah account — if you don't have one, apply for access
- Koah publisher ID from the dashboard
Install
Add the package
In Xcode, go to File → Add Package Dependencies…, enter the repository URL, set the Dependency Rule to Up to Next Major Version starting at 1.1.0, and add the KoahAds product to your target:
https://github.com/koahlabs/swift-package-manager-koah-ads
Or add it to Package.swift:
dependencies: [
.package(url: "https://github.com/koahlabs/swift-package-manager-koah-ads", from: "1.1.0")
]
Prefer a manually-vendored binary? See Manual integration below.
Initialize the SDK
Configure Koah once in your App initializer.
import KoahAds
@main
struct MyApp: App {
init() {
Koah.shared.configure(publisherId: "YOUR_PUBLISHER_ID")
}
var body: some Scene {
WindowGroup { ContentView() }
}
}
Display an ad
KoahCard is the single ad component. Pass a KoahAdContext describing the surface (see Ad context) and a stable cacheKey.
Starting with 1.1.0, server-controlled presentation on iOS helps us experiment and improve ad experiences faster. No additional integration step is needed. See Presentation and performance.
import KoahAds
KoahCard(
adContext: .conversation(question: question, answer: answer),
cacheKey: messageId
)
Style & size your adsOptional
Theme ads to match your brand and bound each slot's size from one place — see theming and sizing on the Appearance page.
Manual integration (XCFramework)
If you can't use Swift Package Manager, vendor the binary directly:
- Download the latest SDK — from the Koah iOS Releases, download
KoahSDK-X.X.X.zipand extract it. - Add to your Xcode project — drag
Koah.xcframeworkinto the project navigator (or your target's General → Frameworks, Libraries, and Embedded Content → +). - Verify embedding — ensure
Koah.xcframeworkis set to Embed & Sign.
Best Practices
- Initialize the SDK as early as possible in your app's lifecycle.
- Apply
.koahTheme(_:)once at the root; nest only when you need a scoped override. - Use unique
cacheKeyvalues per logical placement so impressions track correctly; reuse the same key across renders of the same slot.
Next Steps
- Use Cases — Feed prefetching and other display patterns
- Appearance — Theming, sizing, and card chrome
- Reference — Theme properties, fonts, card options, and size constants
- Visitor Attributes — Share anonymous signals like age range
- Changelog — Release history