New in swift data
Asked on 06/12/2025
1 search
In the session titled "What’s new in SwiftData" from WWDC 2024, several new features and improvements were introduced for SwiftData. Here are some of the highlights:
-
Schema Macro: A new schema macro helps avoid duplicate models, enhancing the efficiency of your app's data model.
-
Model Containers: There are new ways to set up and configure model containers, allowing for more customization, including the ability to create custom data stores.
-
Index Macro: This new feature allows you to add indexes to your data models, which can significantly speed up queries by optimizing how data is stored and retrieved.
-
History API: A new history API is introduced to track changes to your app's models, which is useful for features like syncing with a server or responding to changes from an app extension.
-
Custom Data Stores: You can now create custom data stores that use your own document format or persistence backend, providing flexibility in how data is stored.
For more detailed information, you can watch the session What’s new in SwiftData (00:00:07).

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”.

SwiftData: Dive into inheritance and schema migration
Discover how to use class inheritance to model your data. Learn how to optimize queries and seamlessly migrate your app’s data to use inheritance. Explore subclassing for building model graphs, crafting efficient fetches and queries, and implementing robust schema migrations. Understand how to use Observable and persistent history for efficient change tracking.

Create a custom data store with SwiftData
Combine the power of SwiftData’s expressive, declarative modeling API with your own persistence backend. Learn how to build a custom data store and explore how to progressively add persistence features in your app. To get the most out of this session, watch “Meet SwiftData” and “Model your schema with SwiftData” from WWDC23.