I know how to fix this error, but my fix leads to another error.
The initial problem is the following
@Binding var report: Report
init(property: Property, report: Binding<Report>, saveAction: @escaping () -> Void) {
self.property = property
self.report = report // cannot assign value of type Binding<Report> to type Report
self.data = SpacesData(property: property, report: report)
self.saveAction = saveAction
}
If I change to the following
var report: Binding<Report>
init(property: Property, report: Binding<Report>, saveAction: @escaping () -> Void) {
self.property = property
self.report = report
self.data = SpacesData(property: property, report: report)
self.saveAction = saveAction
}
The error goes away but I can no longer call methods on report. So for instance the following
let image = report.loadCoverImage(for: property)
throws the error
Dynamic key path member lookup cannot refer to instance method 'loadCoverImage(for:)'