I'm trying to bind an array to a list in SwiftUI. I've been struggling to understand how to do this given that I'm quite new to SwiftUI et. al. Here's what I'm trying to:
struct ContentView: View {
@Binding var text: String
@Binding var results: [MKLocalSearchCompletion]
var body: some View {
VStack {
MapView()
MapSearchBar(text: $text, results: $results)
List($results) { result in
Text(result.title)
}
}
}
}
Presently getting, Generic parameter 'SelectionValue' could not be inferred', which I understand-ish, but I can't seem to find my way...
I've not yet come across great doco on this, but I'm happy to be pointed at some.