When I go deeper in a view – by using navigationLinks –, I can't go back to the root view of the application by tapping on the TabItem, so if I tap on "ALL Cars" tab and click tap on "Home" again it will show the last state of that view.
How can I reset the view to show the initial state?
TabView(selection: $selectedTab) {
HomeView()
.tabItem {
if(selectedTab == 0) {
Image("home_active")
.frame(height: 28)
} else {
Image("home_inactive")
.frame(height: 28)
}
Text("HOME")
}.tag(0)
NavigationView {
CarsView()
}
.navigationBarHidden(true)
.tabItem {
if(selectedTab == 1) {
Image("cars_active")
} else {
Image("cars_inactive")
}
Text("ALL Cars").foregroundColor(.white)
}.tag(1)
}