Hello,
since Xcode 13 the following Code does not work anymore, it still worked with Xcode 12
viewController.tabBarItem.badgeColor = color
In the Appearance settings, i can still set the badge color on app start.
let tabBarAppearance = UITabBarAppearance()
tabBarAppearance.configureWithOpaqueBackground()
tabBarAppearance.backgroundColor = UIColor.tabBarBackground
let tabBarItemAppearance = UITabBarItemAppearance()
tabBarItemAppearance.normal.titleTextAttributes = [.font: FontFamily.Arial.regular.font(size: 10.0)!]
tabBarItemAppearance.normal.badgeTextAttributes = [.foregroundColor: UIColor.white, .font: FontFamily.Arial.regular.font(size: 10.0)!]
tabBarItemAppearance.normal.badgeBackgroundColor = UIColor.black
tabBarAppearance.stackedLayoutAppearance = tabBarItemAppearance
UITabBar.appearance().standardAppearance = tabBarAppearance
if #available(iOS 15.0, *) {
UITabBar.appearance().scrollEdgeAppearance = tabBarAppearance
}
In my situation, it is necessary to change the badgeColor depending on the ViewController state, so i need a code like this
viewController.tabBarItem.badgeColor = color
Can you help me? Any ideas?