I have the same issue. The following code works everywhere except views that have Map() in it. In those, everything seems to be reset to defaults…
let normalTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor(Theme.secondary)]
UITabBarItem.appearance().setTitleTextAttributes(normalTextAttributes, for: .normal)
let selectedTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor(Theme.primary)]
UITabBarItem.appearance().setTitleTextAttributes(normalTextAttributes, for: .selected)
let tabBarItemAppearance = UITabBarItemAppearance()
tabBarItemAppearance.normal.titleTextAttributes = normalTextAttributes
tabBarItemAppearance.normal.iconColor = UIColor(Theme.secondary)
tabBarItemAppearance.selected.titleTextAttributes = selectedTextAttributes
tabBarItemAppearance.selected.iconColor = UIColor(Theme.primary)
let tabBarAppearance = UITabBarAppearance()
tabBarAppearance.backgroundColor = UIColor(Theme.background)
tabBarAppearance.inlineLayoutAppearance = tabBarItemAppearance
tabBarAppearance.stackedLayoutAppearance = tabBarItemAppearance
tabBarAppearance.compactInlineLayoutAppearance = tabBarItemAppearance
UITabBar.appearance().isTranslucent = false
UITabBar.appearance().standardAppearance = tabBarAppearance
UITabBar.appearance().scrollEdgeAppearance = tabBarAppearance
Were you able to solve your issue?
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: