Post

Replies

Boosts

Views

Activity

Reply to SwiftUI NavigationLink pops the view instantly in XCode 13.2 watch os simulator 8.3
Made a Test application to test this. If the Navigation view is around tabview, this does not work. But if I set the navigation view inside the tab view, it work. So this does not work: @main struct WatchTabAppApp: App {       @State private var selection: Tab = .one       enum Tab {     case one, two   }       var body: some Scene {     //Working     WindowGroup {       NavigationView { //Navigation view here make instant pop out happen         TabView (selection: $selection){           NavView().tag(Tab.one)           Text("Hoi").tag(Tab.two)         }       }     }   } } struct NavView: View {   var body: some View {     NavigationLink(destination: NewView()     ){       Text("This is link")     }   } } struct NewView: View {   var body: some View {     Text("new one")   } } But when its like this it will work: import SwiftUI @main struct WatchTabAppApp: App {       @State private var selection: Tab = .one       enum Tab {     case one, two   }       var body: some Scene {     //Working     WindowGroup {       TabView (selection: $selection){         NavView().tag(Tab.one)         Text("Hoi").tag(Tab.two)       }     }   } } struct NavView: View {   var body: some View {     NavigationView { //Navigation view here works ok       NavigationLink(destination: NewView()       ){         Text("This is link")       }     }   } } struct NewView: View {   var body: some View {     Text("new one")   } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’21