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

Appearance & Theming

Apply a consistent global theme to all screens presented by OnsideKit using OnsideAppearance.

OnsideAppearance sets global styling for every screen OnsideKit presents. Access the shared instance via Onside.appearance().

Set the global theme

@MainActor func setThemeMode(_ themeMode: OnsideUIThemeMode?)
Onside.appearance().setThemeMode(.dark)

OnsideUIThemeMode:

  • .auto — follow the user's system appearance (Light/Dark)

  • .light — force light

  • .dark — force dark

  • nil — reset the theme setting (does not affect already-presented UI)

The best place to set this is at launch:

func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
    Onside.initialize()
    Onside.appearance().setThemeMode(.dark)   // force dark for all OnsideKit screens
    return true
}

Theme resolution

When OnsideKit presents a screen, the theme is resolved in this order:

  1. A per-screen override from OnsideDelegate.onside(uiThemeOverrideForScreen:), if provided.

  2. The global theme set here via setThemeMode(_:).

  3. The system appearance.

Theme mode is currently the only globally configurable appearance setting.

Last updated

Was this helpful?