Swift Data updates
Asked on 06/11/2025
1 search
At WWDC 2024, several updates and new features were introduced for Swift Data. Here are some of the key updates:
-
Schema Macros: A new schema macro was introduced to help avoid duplicate models. This allows for more efficient data modeling and persistence across app launches.
-
Model Containers: There are new ways to set up and configure model containers, allowing for more customization in how data is stored and managed.
-
Custom Data Stores: Swift Data now supports fully custom data stores, enabling developers to use alternative backends like SQLite, remote web services, or JSON files. This flexibility allows the use of Swift Data's API with various storage formats.
-
Index and Unique Macros: The addition of index and unique macros helps optimize queries by making them more efficient and ensuring no duplicate entries in a set of properties.
-
History API: Swift Data now includes a history API that tracks changes in the data store, making it easier to manage data changes over time and synchronize with remote services.
-
Class Inheritance: New in iOS 26, Swift Data supports class inheritance, allowing developers to build model graphs that harness inheritance, which is useful for models that form a natural hierarchy.
For more detailed information, you can refer to the session What’s new in SwiftData (00:00:07) and SwiftData: Dive into inheritance and schema migration (00:02:11).

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.

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