Cannot convert value of type 'Binding<[Video]>.Type' to expected argument type 'Binding<[Video]>'

Hello, how can I resolve this error ?

Cannot convert value of type 'Binding<[Video]>.Type' to expected argument type 'Binding<[Video]>'

NavigationLink(destination: SomeView.init(data: Binding<[Video]>  ...   //  error is here



Answered by H957169 in 690076022

After correcting the error, this error appeared:

Cannot find '$contentData' in scope

You should show more code.

NavigationLink(destination: SomeView.init(data: Binding<[Video]>

Is it in code ? You need to specify the argument.

If you have defined:

struct SomeView: View {
    @Binding var data: Video

Then, in the view with the NavigationLink, you should have:

struct ContentView: View {
    @State var contentData : Video  = // need to give an initial value, as Video(some arg)

    var body: some View {
        NavigationView {
                NavigationLink(destination: SomeView(data: $contentData)) { or SomeView.init(data: $contentData)
                    Text("Press on me with Binding")
                }.buttonStyle(PlainButtonStyle())
            }
        }
Accepted Answer

After correcting the error, this error appeared:

Cannot find '$contentData' in scope

Can you give me an example of an argument ?

Did you give up ? You did not provide the needed information.

Cannot convert value of type 'Binding&lt;[Video]&gt;.Type' to expected argument type 'Binding&lt;[Video]&gt;'
 
 
Q