Hi. I‘m making an app with SwiftUI for iOS 26, and found that the old ways of changing unselected icons color seem not working as they did in old versions of iOS.
I tried these methods:
TabView() {
Tab {
// some view here
} label: {
Label(title: {
Text("something")
}, icon: {
Image(systemName: "checkmark.seal.fill")
.foregroundStyle(.blue)
}
}
}
I wrapped Image with an if-else, but itisn't able to change any color even without if;
struct ParentView: View {
init() {
UITabBar.appearance()
.unselectedItemTintColor
= UIColor.red
}
var body: some View {
TabView() {
// some tabs here
}
}
}
and an extension of above
struct ParentView: View {
init() {
let tabBarAppearance = UITabBarAppearance()
tabBarAppearance.configureWithOpaqueBackground()
tabBarAppearance.backgroundColor = UIColor.green
tabBarAppearance.stackedLayoutAppearance
.selected.titleTextAttributes
= [.foregroundColor: UIColor.red]
tabBarAppearance.stackedLayoutAppearance.normal
.titleTextAttributes
= [.foregroundColor: UIColor.black]
tabBarAppearance.stackedLayoutAppearance
.normal.iconColor = UIColor.black
tabBarAppearance.stackedLayoutAppearance
.selected.iconColor = UIColor.red
UITabBar.appearance()
.scrollEdgeAppearance
= tabBarAppearance
UITabBar.appearance()
.standardAppearance
= tabBarAppearance
UITabBar.appearance()
.unselectedItemTintColor
= .black
}
var body: some View {
TabView() {
// some tabs here
}
}
}
I read about this from reddit https://www.reddit.com/r/iOSProgramming/comments/1ftmfoa/tabbartabview_icon_and_text_colors_in_ios_18/
,
it successfully changes the color of the texts in the tabbar, but not the icons.
After these, GitHub Copilot suggested me to draw two versions of icons, for different colors, which does work, but out of my capabilities. Is there any other ways to do this on new systems?
Thank you very much for any replies.