struct Foo: View {
@State var bar = false
var body: some View {
Toggle($bar) { Text("Bar") } // $bar should be State<Bool>, but Toggle accepts Binding<Bool>
}
}
Could someone explain to me how $bar is resolved?
Since it's @State<Bool>
it should be of type State<Bool>
, but Toggle seems to accept only Binding
.
Disclaimer: I don't have Xcode 11, but only read the doc from apple's website (and watched a lot of online videos ).