I am using SwiftData for storage and have a view that uses the @Query property wrapper with a sort descriptor that points to a relationship on a model. In a release build on device running iOS 18.3, the app crashes.
This is the line that crashes:
@Query(sort: \Item.info.endDate, order: .reverse) private var items: [Item]
Item
has a relationship to ItemInfo
, which is where the endDate
property is defined. This code works in debug and on a simulator.
In the project referenced here: https://github.com/lepolt/swiftdata-crash, change the scheme build configuration to “Release” and run on device. The app will crash.
Using Xcode Version 16.2 (16C5032a) iPhone 12, iOS 18.3 (22D60)