Sort on the @relationship property wrapper

Hello Developer Support,

Let's say I have the following models. Is there a way to have dataSet pre-sorted by swiftData?


@Model
Struct Capture {
   let someInfo: String

   @Relationship(.unique, deleteRule: .cascade)  // some way of sorting by CoolPoint.date
   let dataSet: [CoolPoint]
}

@Model
struct CoolPoint {
   let point: Int
   let date: Date
}
Post not yet marked as solved Up vote post of John-Doe Down vote post of John-Doe
310 views