Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Using relationships in SortDescriptor crashing on release

If use a SortDescriptor for a model and sort by some attribute from a relationship, in DEBUG mode it all works fine and sorts. However, in release mode, it is an instant crash.

  • SortDescriptor<Task>(.name, order: .reverse) ---- works
  • SortDescriptor<Task>(.assignedUser?.name, order: .reverse) ---- works in debug but crash in release.

What is the issue here, is it that SwiftData just incompetent to do this?

Is this issue the same as the one discussed here? If yes, please follow up in that thread so all the information is consolidated there.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Using relationships in SortDescriptor crashing on release
 
 
Q