SwiftData is not capable of filtering and sorting by raw representable enum properties in models. Predicates and sort descriptors will compile just fine when referencing enum properties, but it will crash at runtime.
This is an excerpt from our episode exploring modern persistence techniques in applications.
Our free plan includes 1 subscriber-only episode of your choice, access to 72 free episodes with transcripts and code samples, and weekly updates from our newsletter.