The follow code will produce the following error.
Cannot convert value of type 'Binding' to expected argument type 'Binding<_>'
import SwiftUI
struct ContentView : View {
@State private var KG: Int = 30;
@State private var Adult: Bool = true;
var body: some View {
VStack {
Picker(selection: $Adult, label: Text("Classification")) {
Text("Adult").tag(true)
Text("Pediatric").tag(false)
}
Picker(selection: $KG, label: Text("KG")) {
Text("30").tag(30)
Text("35").tag(35)
Text("40").tag(40)
Text("45").tag(45)
Text("50").tag(50)
Text("55").tag(55)
Text("60").tag(60)
Text("65").tag(65)
Text("70").tag(70)
Text("75").tag(75)
Text("80").tag(80)
}
Button(action: {
// Do Stuff
}) {
Text("Calculate")
}
}
}
}
#if DEBUG
struct ContentView_Previews : PreviewProvider {
static var previews: some View {
ContentView()
}
}
#endif
Steps to reproduce are as a follows.
- Create New Project (For Apple Watch)
- Use SwiftUI
- Replace the code in ContentView.swift with the above code.
- Wait for the error.
I'm using XCode Version 11.0 beta (11M336w)
Expected Result
I would think that we would be allowed to have any number of Tagged Text Items within a Picker.