Why you can't use enums in SwiftData

Video Clip • Jun 5, 2025

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.

Get started with our free plan

Our free plan includes 1 members only episode of your choice, access to 75 free episodes with transcripts and code samples, and weekly updates from our newsletter.

View plans and pricing