@Query SortDescriptor with a Boolean

I cannot figure out how to sort a SwiftData query based on a boolean value. My sort works perfectly well for a string, date, int, etc. But crashes with a boolean.

Hello,

I have not yet used SwiftData, but what init are you using for the SortDescriptor? I see this one in the documentation: [https://developer.apple.com/documentation/foundation/sortdescriptor/3802525-init)

init(
    _ keyPath: KeyPath<Compared, Bool>,
    order: SortOrder = .forward
) where Compared : NSObject

Is says that is needs to conform to NSObject. So might need to bridge it somehow so that the types are compatible. There is a way to do it via NSNumber.

@Query SortDescriptor with a Boolean
 
 
Q