Post

Replies

Boosts

Views

Activity

SwiftData `unsupportedPredicate` when `Query` via a relationship
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! }
1
0
783
Sep ’23