SDKs

iOS SDK

Swift Package Manager, XCFramework distribution, and native UIKit/SwiftUI support.

Prompt for coding agents

I want to set up Koah's iOS SDK. Read https://docs.koahlabs.com/SKILL.md and follow its instructions.

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

1

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")
]
2

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() }
    }
}
3

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

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:

  1. Download the latest SDK — from the Koah iOS Releases, download KoahSDK-X.X.X.zip and extract it.
  2. Add to your Xcode project — drag Koah.xcframework into the project navigator (or your target's General → Frameworks, Libraries, and Embedded Content → +).
  3. Verify embedding — ensure Koah.xcframework is 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 cacheKey values per logical placement so impressions track correctly; reuse the same key across renders of the same slot.

Next Steps

Was this helpful?