For the complete documentation index, see llms.txt. This page is also available as Markdown.

The Onside Delegate

Customize OnsideKit with OnsideDelegate — host window scene, per-screen theme override, login routing, and a pre-login region hint.

OnsideDelegate lets you tune how OnsideKit presents its screens and routes login. Every method has a default implementation, so implement only the ones you need.

protocol OnsideDelegate: AnyObject {
    @MainActor func onside(hostWindowSceneForScreen screen: OnsideScreen) -> UIWindowScene?
    @MainActor func onside(uiThemeOverrideForScreen screen: OnsideScreen) -> OnsideUIThemeMode?
    @MainActor func onsideShouldForceLocalLoginMethods() -> Bool
    @MainActor func onsideDefaultCountryCodeAssumption() -> String?
}

Assign your delegate (keep a strong reference — it's held weakly), typically at launch:

@main
final class AppDelegate: UIResponder, UIApplicationDelegate, OnsideDelegate {
    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
        Onside.initialize()
        Onside.delegate = self
        return true
    }
}

OnsideScreen

Several delegate methods receive the screen OnsideKit is about to present:

Host window scene

Return the UIWindowScene in which OnsideKit should present the given screen — useful in multi-window apps. If you return nil (the default), OnsideKit uses the first active connected scene.

Per-screen theme override

Force a theme for a specific screen, overriding the global theme and the system appearance:

  • .light / .dark — force that theme

  • .auto — follow the system setting

  • nil (default) — no override; fall back to the global theme, then the system theme

Force in-SDK login

By default OnsideKit prefers the app-to-app login via the Onside store app. Return true to always use OnsideKit's own in-app login screen instead. It is purely a UI-routing switch — it doesn't change which credentials are accepted. Default: false. See Authentication & User Account.

Pre-login region hint

Provide an ISO 3166-1 alpha-2 country code (e.g. "US", "DE") to use as the region before the user logs in, improving logged-out pricing and availability. Return nil (default) to use the device region. Once the user logs in, the account's region is used and this hint is ignored. See Regions & Storefronts.

Last updated

Was this helpful?