I have the next TabView
:
TabView(selection: self.$viewModel.selection) {
StoriesView()
.tabItem {
Label("Stories", systemImage: "play.square") // I need a yellow icon here
}
.tag("stories")
MessengerView()
.tabItem {
Label("Messenger", systemImage: "message") // I need a green icon here
}
.tag("messenger")
ProfileView()
.tabItem {
Label("Profile", systemImage: "person") // I need a red icon here
}
.tag("profile")
}
It works perfectly but I can’t get how to set an own colour for every tab icon. I’ve tried all possible methods already foregroundColor()
, accentColor()
, tint()
and so on… A nothing works. It changes a color of all tab icons or no one icon.
How to make it in TabView
?
P.S. Maybe it’s a noobie’s question but I really got challenged.
2
Answers
Hey this is how i did it. I just used Zstacks and added rectangle() and assigned color to that.
I made a custom one. You can make changes as you want. I hope that’s will help you.
Like you can change opacity when changes the pages and hide back button for solid tabview.