xcodeswiftuiios14swiftui-navigationlinkios-navigationview

conflicts with navigation view on SwiftUI


i have some trouble with my app when switching between views and after many attempt the screen become white then the app become unusable, how can i resolve this problem thanks in advance.

my app structure : all views are embedded in an NavigationView and the switchers as navigationsLink with destination exemple:

                       ` struct Home: View {
                            
                            var body: some View {
                                NavigationView(){
                                    
                                    //My view content
                                    //
                                    //My Menu for switching between views
                                    
                                    NavigationLink (destination: Settings()) {
                                        Image("gear-light")
                                    }
                                }
                            }
                        }`

very important i'm working on an IOS 14.0 app version only

i have tried .sheet with the navigationLink with .dismiss() for close it did not work


Solution

  • "all views are embedded in an NavigationView" does this mean you have a NavigationView in every screen as you have here in Home?

    If so you only want the NavigationView at the top level i.e. Home, but not in Settings in this case.