Here are my optional binding
@Binding var showSheetModifFile : Bool?
@Binding var fileToModify : File?
init( showSheetModifFile : Binding<Bool?>? = nil, fileToModify : Binding<File?>? = nil) {
_showSheetModifFile = showSheetModifFile ?? Binding.constant(nil)
_fileToModify = fileToModify ?? Binding.constant(nil)
}
So now when I try to call this constructor:
@State var showModifFileSheet : Bool? = false
@State var fileToModify : File? = File()
...
SingleFileView(showSheetModifFile: self.$showModifFileSheet, fileToModify: self.$fileToModify)
I got this error:
'Binding<Bool?>' is not convertible to 'Binding<Bool?>?'