private struct TransactionItemsView: View {
init(journal: Journal, budgetMode: Bool) {
let journalID = journal.id!
_entries = .init(filter: #Predicate {
$0.journal!.id! == journalID
}, sort: \.date, order: .reverse)
// HERE: Query encountered an error: SwiftData.SwiftDataError(_error: SwiftData.SwiftDataError._Error.unsupportedPredicate)
}
@Query var entries: [Entry]
...
}
My model:
// unimportant code like `init` is hidden
@Model
final class Journal {
...
var id: UUID!
@Relationship(deleteRule: .cascade, inverse: \Entry.journal) var entries: [Entry]! = []
}
@Model
final class Entry {
...
@Relationship(deleteRule: .nullify) var journal: Journal!
}