From 0c8e78f49dc733e55aa35c4db61277c7b8bdd495 Mon Sep 17 00:00:00 2001 From: Sven Date: Thu, 23 Apr 2026 14:09:29 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20#36:=20Tab-Bar=20Liquid=20Glass=20?= =?UTF-8?q?=E2=80=93=20keine=20eigene=20UITabBarAppearance=20mehr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit iOS 26 rendert die Tab-Bar mit Liquid Glass und passt Hell/Dunkel automatisch an den Hintergrund an. Eigene UITabBarAppearance- Konfigurationen (insbes. configureWithOpaqueBackground) blockieren diesen Mechanismus und verursachen den weißen Flicker. Änderungen: - UITabBarAppearance vollständig entfernt; Liquid Glass übernimmt - .preferredColorScheme(isDark ? .dark : .light) gesetzt – informiert das System über den Modus des aktiven Themes, sodass Liquid Glass, Sheets und Alerts korrekt hell/dunkel erscheinen - UINavigationBarAppearance bleibt als Fallback für Views ohne themedNavBar Co-Authored-By: Claude Sonnet 4.6 --- nahbar/nahbar/NahbarApp.swift | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/nahbar/nahbar/NahbarApp.swift b/nahbar/nahbar/NahbarApp.swift index 0b82efc..c873905 100644 --- a/nahbar/nahbar/NahbarApp.swift +++ b/nahbar/nahbar/NahbarApp.swift @@ -104,6 +104,9 @@ struct NahbarApp: App { .animation(.easeInOut(duration: 0.40), value: showSplash) .environment(\.nahbarTheme, activeTheme) .tint(activeTheme.accent) + // Zwingt das System in den richtigen Light/Dark-Modus für das aktive Theme – + // dadurch passt Liquid Glass (Tab-Bar, Sheets, Alerts) automatisch korrekt an. + .preferredColorScheme(activeTheme.id.isDark ? .dark : .light) .onAppear { NahbarApp.applyTabBarAppearance(activeTheme) cloudSyncMonitor.startMonitoring(iCloudEnabled: icloudSyncEnabled) @@ -132,32 +135,12 @@ struct NahbarApp: App { applyTabBarAppearance(NahbarTheme.theme(for: themeID)) } - /// Setzt UITabBar- und UINavigationBar-Appearance für das gegebene Theme. - /// Statisch, damit AppDelegate und Theme-Change-Handler dieselbe Logik nutzen. - /// configureWithOpaqueBackground() verhindert das weiße Aufblitzen bei dunklen Themes. + /// 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. static func applyTabBarAppearance(_ theme: NahbarTheme) { - let bg = UIColor(theme.backgroundPrimary) // vollständig opak – kein Bleed-through - let normal = UIColor(theme.contentTertiary) - let selected = UIColor(theme.accent) - let border = UIColor(theme.borderSubtle) - - 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() // statt transparent – stabil bei dunklen Themes - tabAppearance.backgroundColor = bg - tabAppearance.shadowColor = border - tabAppearance.stackedLayoutAppearance = item - tabAppearance.inlineLayoutAppearance = item - tabAppearance.compactInlineLayoutAppearance = item - - UITabBar.appearance().standardAppearance = tabAppearance - UITabBar.appearance().scrollEdgeAppearance = tabAppearance - + let border = UIColor(theme.borderSubtle) + let selected = UIColor(theme.accent) let navBg = UIColor(theme.backgroundPrimary) let titleColor = UIColor(theme.contentPrimary)