Fix #36: Tab-Bar Liquid Glass – keine eigene UITabBarAppearance mehr

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 <noreply@anthropic.com>
This commit is contained in:
2026-04-23 14:09:29 +02:00
parent 8180fcbcbc
commit 0c8e78f49d
+7 -24
View File
@@ -104,6 +104,9 @@ struct NahbarApp: App {
.animation(.easeInOut(duration: 0.40), value: showSplash) .animation(.easeInOut(duration: 0.40), value: showSplash)
.environment(\.nahbarTheme, activeTheme) .environment(\.nahbarTheme, activeTheme)
.tint(activeTheme.accent) .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 { .onAppear {
NahbarApp.applyTabBarAppearance(activeTheme) NahbarApp.applyTabBarAppearance(activeTheme)
cloudSyncMonitor.startMonitoring(iCloudEnabled: icloudSyncEnabled) cloudSyncMonitor.startMonitoring(iCloudEnabled: icloudSyncEnabled)
@@ -132,32 +135,12 @@ struct NahbarApp: App {
applyTabBarAppearance(NahbarTheme.theme(for: themeID)) applyTabBarAppearance(NahbarTheme.theme(for: themeID))
} }
/// Setzt UITabBar- und UINavigationBar-Appearance für das gegebene Theme. /// Setzt UINavigationBar-Appearance für das gegebene Theme.
/// Statisch, damit AppDelegate und Theme-Change-Handler dieselbe Logik nutzen. /// Hinweis: UITabBarAppearance wird bewusst NICHT gesetzt in iOS 26 übernimmt
/// configureWithOpaqueBackground() verhindert das weiße Aufblitzen bei dunklen Themes. /// Liquid Glass die Tab-Bar automatisch; eigene Hintergründe interferieren damit.
static func applyTabBarAppearance(_ theme: NahbarTheme) { 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 border = UIColor(theme.borderSubtle)
let selected = UIColor(theme.accent)
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 navBg = UIColor(theme.backgroundPrimary) let navBg = UIColor(theme.backgroundPrimary)
let titleColor = UIColor(theme.contentPrimary) let titleColor = UIColor(theme.contentPrimary)