Hi guys, while in subView It's possible to navigate back to first view tapping on the tab bar item?
This is my code
struct ContentView: View {
@State private var selection = 0
var body: some View {
TabView(selection: $selection){
firstView()
.tabItem {
VStack {
Image("first")
Text("first")
}
}
.tag(0)
secondView()
.tabItem {
VStack {
Image("second")
Text("second")
}
}
.tag(1)
}
}
}
//code of firstView
struct firstView: View {
var body: some View {
NavigationView {
NavigationLink(destination: subView()){
Text("go to subView")
}
}
}