SDKsiOS

Appearance

Theme Koah ads in SwiftUI with the .koahTheme(_:) modifier.

Theming

πŸ’‘
See how it looks in the playground.

To customize the appearance of Koah ads, apply .koahTheme(_:) once at the root of your view tree and every Koah ad below it picks the theme up via SwiftUI's environment:

ContentView()
    .koahTheme(
        KoahTheme(
            colorScheme: .auto,
            accentColor: .green
        )
    )

For the full list of theme properties, see Theme properties in the reference.

Sizing

Koah ads are fully resizable. Bound each axis independently with the width and height parameters (KoahAxisSize): .fixed(_:) forces an exact size, .range(min:max:) bounds while wrapping content, .fill takes the parent's available space, and omitting an axis lets the card wrap its content within whatever space the parent gives it.

πŸ’‘

Leaving width / height unbounded allows more ad formats, improving fill rates and revenue.

KoahCard(
    adContext: .conversation(question: q, answer: a),
    width: .range(max: 360),
    cacheKey: "msg-1"
)

The 0.x overrideMaxWidth / overrideMaxHeight initializer is removed in 1.0 β€” map those values to width: .range(max:) / height: .range(max:); see the migration guide. See Card sizing in the reference for the full table.

Card chrome

KoahCard renders inside the standard chrome (rounded background, 0.5pt border, padding) by default. Pass chrome: .bare to render borderless and embed the ad directly into your own surface like a chat row or list cell:

KoahCard(
    adContext: .conversation(question: q, answer: a),
    cacheKey: "msg-1",
    chrome: .bare
)
Was this helpful?