Good morning,
I am having trouble understanding the error message
Instance member 'dateFrom' cannot be used on type 'AdministrationReport'; did you mean to use a value of this type instead?
Read up on Swift doc for properties but still cannot see how to get value ( although I suspect it is simple) .
I am passing date vars to generate a query for a report
struct AdministrationReport: View {
@Environment(\.modelContext) var context
@State var dateFrom: Date
@State var dateTo: Date
@State var reportCycles: Bool
@State var reportLabels: Bool
@Query (filter: #Predicate<Pouch> { pouch in
pouch.packDate >= dateFrom && pouch.packDate <= dateTo }, \\ error here
sort: [SortDescriptor(\Pouch.packDate)]) var pouches: [Pouch]
var body: some View {
NavigationStack {
Form {
Text("Report")
Without the query it is confirmed the vars are passed . I am stuck in using them in the query predicate .
Any direction is appreciated
Regards
Joel