From 2c274ff4ae55b39027bf997d947c7dad6c9cb9b5 Mon Sep 17 00:00:00 2001 From: Sven Date: Thu, 23 Apr 2026 14:31:59 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20#36:=20iOS-17-Kompatibilit=C3=A4t=20?= =?UTF-8?q?=E2=80=93=20UITabBarAppearance=20per=20#unavailable(iOS=2026)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Auf iOS 17–25 setzt UITabBarAppearance weiterhin die Theme-Farben (kein Liquid Glass → kein Konflikt, kein Flicker). Auf iOS 26+ bleibt der Block weg, Liquid Glass + .preferredColorScheme übernehmen die Tab-Bar. Co-Authored-By: Claude Sonnet 4.6 --- nahbar/nahbar/NahbarApp.swift | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) 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