I can't seem to get this simple problem working. I have a TabView with multiple Tabs, where depending on the selectedTab, the TabBar should have a different background. It should look like this, but this won't work, any help would be highly appreciated:
TabView(selection: $selectedTab){
NavigationView{
Home()
}
.navigationViewStyle(StackNavigationViewStyle())
.tabItem{
Image(systemName: "house")
}.tag("home")
.onAppear{
UITabBar.appearance().backgroundColor = UIColor.white
}
NavigationView{
Post()
}
.navigationViewStyle(StackNavigationViewStyle())
.tabItem{
Image(systemName: "plus")
}.tag("plus")
.onAppear{
UITabBar.appearance().backgroundColor = UIColor.clear
}
}
Aucun commentaire:
Enregistrer un commentaire