@DTS Engineer this is still an issue in iOS 26 when sorting on a property of an optional relationship.
@Query(sort: \Item.info?.endDate, order: .reverse) private var items: [Item]
@Model
final class Item {
var info: ItemInfo?
init(info: ItemInfo) {
self.info = info
}
}
@Model
final class ItemInfo {
var endDate: Date
init(endDate: Date) {
self.endDate = endDate
}
}
SwiftData/DataUtilities.swift:85: Fatal error: Couldn't find \Item.<computed 0x000000010295573c (Optional<ItemInfo>)>?.<computed 0x0000000102955744 (Date)>? on Item with fields [SwiftData.Schema.PropertyMetadata(name: "info", keypath: \Item.<computed 0x0000000102954c58 (Optional<ItemInfo>)>, defaultValue: nil, metadata: nil)]
iOS Simulator 26.0 beta 4 (23A5297i)
Xcode Version 26.0 beta 4 (17A5285i)
I made a minimal fork of the project @Atletismo343 provided: https://github.com/coughski/swiftdata-crash
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: