Missing argument for parameter #1 in call, Insert '<#LocalizedStringKey#,>'

error appears when i try to put navigation link inside button code

             Button("back") {
              NavigationLink(destination: ContentView())
          }
                               ^
Answered by MDDevelopment in 726832022

The NavigationLink needs also a title or label as an argument. Also, you don't need to put a navigation link in a button because it's already a button. This code would be correct:

                NavigationLink("Back") {

                    ContentView()

                }

Or this:

                NavigationLink {

                    ContentView()

                } label: {

                    Text("Back")

                }

I hope it helps

Accepted Answer

The NavigationLink needs also a title or label as an argument. Also, you don't need to put a navigation link in a button because it's already a button. This code would be correct:

                NavigationLink("Back") {

                    ContentView()

                }

Or this:

                NavigationLink {

                    ContentView()

                } label: {

                    Text("Back")

                }

I hope it helps

Missing argument for parameter #1 in call, Insert '&lt;#LocalizedStringKey#,&gt;'
 
 
Q