I have a question about optional bindings in swiftUI. I have a struct:
struct LightPairing: View {
@Binding var light: Color?
init(light: Binding<Color?>) {
self._light = light
}
// the rest of the code, such as body is omitted since it is very long
}
I want to give the light property a default value of nil, light: Binding<Color?> = nil, but it does not work. Is there anyway to get around this issue?
Edit: When I do:
light: Binding<Color?> = nil
I get the error message saying
"Nil default argument value cannot be converted to type Binding<Color?>"