That is my definition for fetch request:
import SwiftUI
struct CurrentMonthView: View {
non-public var month: Month
@FetchRequest(
sortDescriptors: [SortDescriptor(.date, order: .forward)],
predicate: NSPredicate(format: "month.identifier == %@", month.identifier), //❌
animation: .easeInOut
) var companies: FetchedResults
init(month: Month) {
self.month = month
}
var physique: some View {
ForEach(companies) { service in }
}
}
The ❌ is the next: Can't use occasion member 'month' inside property initializer; property initializers run earlier than 'self' is obtainable
.
What’s the appropriate technique to outline @FetchRequest to make it working in above conditions? I believe it is vitally widespread.