TabView(selection:$selectedTab) {
HomeTabbarView()
.tabItem {
if selectedTab = = 0 {
Image("icons_filled_chats")}else{
Image("icons_outlined_chats")}Text("WeChat")
}.tag(0)
PhoneBookTabbarView()
.tabItem {
if selectedTab = = 1 {
Image("icons_filled_contacts")}else{
Image("icons_outlined_contacts")}Text("Address book")
}.tag(1)
DiscoverTabbarView()
.tabItem {
if selectedTab = = 2 {
Image("icons_filled_discover")}else{
Image("icons_outlined_discover")}Text("Discovered")
}.tag(2)
UserTabbarView()
.tabItem {
if selectedTab = = 3 {
Image("icons_filled_me")}else{
Image("icons_outlined_me")}Text("I")
}.tag(3)}// The color setting is unchecked by default
.onAppear(){
UITabBar.appearance().unselectedItemTintColor = UIColor.init(red: 64.0/255.0, green: 64.0/255.0, blue: 64.0/255.0, alpha: 1)}Copy the code