Post

Replies

Boosts

Views

Activity

Reply to SwiftData crashes with @Query using major/minor sort descriptors
Hey Guys, I think I'm experiencing a similar sort of crash in my app. Here is my situation, I have a list of records and in one of my views I define the query like this: @Query(sort: \Record.bestScore, order: .reverse) private var records: [Record] and down in the view I have a list that shows the records, List(records, id: \.title) { rec in ... } In my case I have a relation in the Record that is defined as below, @Relationship(deleteRule: .nullify, inverse: \RecordManager.relevantRecords) var topMatches: [RecordManager] = [] however, as you see, in my case the variable topMatches is not nil, it is initially set to an empty array (not sure if the .nullify deleteRule could be causing the error?). The problem is my code sometimes crash and when I check the stack trace it is on the line of List(records, id:.title). Any thoughts why this is happening?
Jan ’24