I am tearing out my hair trying to figure out how to bind the picked value in my SwiftUI view:
The picker needs to be bound to the Int returned from the tags. I need to covert this Int to the String and set the Binding. How?
struct ContentView: View { @Binding var operatorValueString:String var body: some View { Picker(selection: queryType, label: Text("Query Type")) { ForEach(0..<DM.si.operators.count) { index in Text(DM.si.operators[index]).tag(index) } }.pickerStyle(SegmentedPickerStyle()) } } How and where can I set my operatorValueString ?
operatorValueString = DM.si.operators[queryType] //won't compile.