Can confirm, this crash still occurs in Xcode 15.4 whether I use an enum with Comparable or its rawValue.
var descriptor: FetchDescriptor<FoodItem> {
// SwiftData cannot currently sort by custom Enum type, even if it conforms to Comparable and Int
let sortDescriptor = SortDescriptor(\MyItem.rarity, order: .forward)
let descriptor = FetchDescriptor(sortBy: [sortDescriptor])
return descriptor
}
...
@Query(descriptor) var items: [MyItem]