diff --git a/nahbar/nahbar/NahbarApp.swift b/nahbar/nahbar/NahbarApp.swift index c873905..1c04d03 100644 --- a/nahbar/nahbar/NahbarApp.swift +++ b/nahbar/nahbar/NahbarApp.swift @@ -135,15 +135,40 @@ struct NahbarApp: App { applyTabBarAppearance(NahbarTheme.theme(for: themeID)) } - /// Setzt UINavigationBar-Appearance für das gegebene Theme. - /// Hinweis: UITabBarAppearance wird bewusst NICHT gesetzt – in iOS 26 übernimmt - /// Liquid Glass die Tab-Bar automatisch; eigene Hintergründe interferieren damit. + /// Setzt UIKit-Appearance für das gegebene Theme. + /// Auf iOS 26+ übernimmt Liquid Glass die Tab-Bar automatisch – + /// eigene UITabBarAppearance-Hintergründe würden es stören. + /// Auf iOS 17–25 wird die Tab-Bar explizit in Theme-Farben eingefärbt. static func applyTabBarAppearance(_ theme: NahbarTheme) { let border = UIColor(theme.borderSubtle) let selected = UIColor(theme.accent) let navBg = UIColor(theme.backgroundPrimary) let titleColor = UIColor(theme.contentPrimary) + // iOS 17–25: Liquid Glass existiert nicht; eigene UITabBarAppearance nötig. + // iOS 26+: Block weggelassen – Liquid Glass + .preferredColorScheme übernehmen. + if #unavailable(iOS 26) { + let bg = UIColor(theme.backgroundPrimary) + let normal = UIColor(theme.contentTertiary) + + let item = UITabBarItemAppearance() + item.normal.iconColor = normal + item.normal.titleTextAttributes = [.foregroundColor: normal] + item.selected.iconColor = selected + item.selected.titleTextAttributes = [.foregroundColor: selected] + + let tabAppearance = UITabBarAppearance() + tabAppearance.configureWithOpaqueBackground() + tabAppearance.backgroundColor = bg + tabAppearance.shadowColor = border + tabAppearance.stackedLayoutAppearance = item + tabAppearance.inlineLayoutAppearance = item + tabAppearance.compactInlineLayoutAppearance = item + + UITabBar.appearance().standardAppearance = tabAppearance + UITabBar.appearance().scrollEdgeAppearance = tabAppearance + } + let navAppearance = UINavigationBarAppearance() navAppearance.configureWithOpaqueBackground() navAppearance.backgroundColor = navBg