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
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
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())
}
}
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.