How do I manually init a Swift Binding, with a desired wrapped value?
Using Bool as type, here is most basic desired init
let b: Binding<Bool> = Binding.init(true)
//errors out with messages:
Cannot convert value of type 'Bool' to expected argument type 'Binding<Bool?>
Value of optional type 'Binding<Bool>?' must be unwrapped to a value of type 'Binding<Bool>'
Questions I have
- Why does the above error out?
- What is the correct syntax to init a simple Bool binding
- Why must optionals be involved in the type signature (<'Binding<Bool?>)