Can we have more functions in SwiftData prediction macros?
Asked on 08/06/2024
1 search
Yes, you can have more functions in SwiftData prediction macros. The context from the "Platforms State of the Union" session mentions that SwiftData has expanded capabilities, including new macros like index
and unique
, which enhance the modeling capabilities. Additionally, the "What’s new in SwiftData" session elaborates on these new macros and their benefits, such as improving performance and avoiding duplicate models.
For more detailed information, you can refer to the session What’s new in SwiftData (11:56).
Relevant Sessions

Bring your machine learning and AI models to Apple silicon
Learn how to optimize your machine learning and AI models to leverage the power of Apple silicon. Review model conversion workflows to prepare your models for on-device deployment. Understand model compression techniques that are compatible with Apple silicon, and at what stages in your model deployment workflow you can apply them. We’ll also explore the tradeoffs between storage size, latency, power usage and accuracy.

Platforms State of the Union
Discover the newest advancements on Apple platforms.

What’s new in SwiftData
SwiftData makes it easy to add persistence to your app with its expressive, declarative API. Learn about refinements to SwiftData, including compound uniqueness constraints, faster queries with #Index, queries in Xcode previews, and rich predicate expressions. Join us to explore how you can use all of these features to express richer models and improve performance in your app. To discover how to build a custom data store or use the history API in SwiftData, watch “Create a custom data store with SwiftData” and “Track model changes with SwiftData history”.