What are the new updates about SwiftData?
Asked on 06/11/2025
2 searches
The new updates about SwiftData, as presented at WWDC, include several enhancements and features:
-
Schema Customization: SwiftData now includes a new schema macro to help avoid duplicate models. This allows for more efficient data modeling and management.
-
Model Containers: There are new ways to set up and configure model containers, which are crucial for managing the data model within your app.
-
Query Optimization: SwiftData introduces complex filters and a new macro to improve query performance, making data retrieval more efficient.
-
Indexing and Uniqueness: The addition of
index
andunique
features allows for more efficient queries and ensures that certain properties do not have duplicate entries. -
Custom Data Stores: SwiftData now supports custom data stores, allowing developers to use alternative backends like SQLite or a remote web service, providing greater flexibility in data storage solutions.
-
History API: A new history API is available to track changes in the data store, which is useful for syncing data with remote services or handling changes from app extensions.
For more detailed information, you can refer to 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”.

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

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.