I have a problem with SwiftUI and tabview and the problem is when I'm on a second navigation page it's back to the first navigation when I need to open a sheet. Tab1->FirstView->Secondview->Sheet after the sheet opened the navigation view behind the scene switched to first navigation!
import SwiftUI struct ContentView: View { var body: some View { NavigationView{ TabView{ Tab1() .tabItem({Text("tab1")}) Tab2() .tabItem({Text("tab2")}) } } } } struct Tab1: View { @State var shownextPage = false var body: some View { ZStack{ Button ("Next Page"){ shownextPage = true } NavigationLink( destination: SecondView(), isActive: $shownextPage) { EmptyView() } } } } struct Tab2: View { var body: some View { Text("Tab 2 detail") } } struct SecondView: View { @State var showSheet:Bool = false var body: some View { VStack{ Button { showSheet = true } label: { Text("open Sheet") .padding() } .sheet(isPresented: $showSheet, onDismiss: nil) { Text("hello in sheet") } } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }