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 darknil— 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:
A per-screen override from
OnsideDelegate.onside(uiThemeOverrideForScreen:), if provided.The global theme set here via
setThemeMode(_:).The system appearance.
Last updated
Was this helpful?