Cannot find 'SecondView' in scope in swiftui error NavigationView.

How can I resolve this error ? Cannot find 'SecondView' in scope in NavigationView :

NavigationView {

            VStack(spacing: 30) {

                Text("...")

                Spacer()

                NavigationLink(destination: SecondView())  // Here is error {

                    Text; (("..."))

                        .foregroundColor(....)

                }

                Button("...") {

        self.selection = "..."

                }

           }

Where is the definition of SecondView? When you show your code, you should better show whole code together. Whether your code works or not depends on other parts of your code.

At first I want to check without code if it works. after removing this error it should work on a blank screen.

You should have somewhere in this code:

struct SecondView: View {

    var body: some View {
       Text("Hi, I am your second View")  // Just to display something
    }
}

Defining struct alone did not help, the error still occurs.

You have a semicolon here:

                    Text; (("..."))

Is it intentional ? That's not correct syntax.

Double parenthesis are superfluous as well.

Cannot find 'SecondView' in scope in swiftui error NavigationView.
 
 
Q