I tried to change icon's color with UITabBar.appearance().unselectedItemTintColor but it works only with systemImage and doesn't highlight image, only text.
init() {
UITabBar.appearance().unselectedItemTintColor = .secondaryLabel
}
TabView {
FirstView()
.tabItem {
Text("Home")
Image("home")
}
CatalogView()
.tabItem {
Text("Categories")
Image("catalog")
}
CustomerProfileView()
.tabItem {
Text("Profile")
Image("profile")
}
ShoppingView()
.tabItem {
Text("Cart")
Image("shoppingbasket")
}
}
I also tried .accentColor but Xcode says it will be deprecated.
You can use foregroundColor
in this case.
Image("shoppingbasket")
.renderingMode(.template)
.foregroundColor(Color(.secondaryLabel))