This post is from the WWDC26 SwiftData Q&A.
Aggregate functions in SwiftData
Recommended
That sounds like a great idea! Please use Feedback Assistant to provide suggestions and explain your use case in detail
Hello @Frameworks Engineer @cgontijo,
I filed feedback for that in January 2024.
Basically, the equivalent to NSExpression functions like sum/average/max/median.
https://developer.apple.com/documentation/foundation/nsexpression/1413747-expressionforfunction
- FB13522377
- FB13522406
- FB13521724
- FB13522412
- FB13522411
- FB13522401
- FB13522382
Feel free to check them. It's blocking me from adopting SwiftData because I can't do any operation on my data set as I have to fetch all objects into memory with SwiftData.
Regards,
Axel