What's new in swift data
Asked on 06/12/2025
1 search
SwiftData has introduced several new features and improvements, as highlighted in the WWDC sessions:
-
Schema Macros: SwiftData now includes a new schema macro to help avoid duplicate models. This is part of the framework's effort to make data modeling more efficient and safe by leveraging modern Swift language features like macros.
-
Model Containers: There are new ways to set up and configure model containers, which are crucial for managing how data is stored and accessed within an app.
-
Query Optimization: SwiftData has introduced complex filters and a new macro to optimize query performance, making data retrieval faster and more efficient.
-
Custom Data Stores: SwiftData now supports custom data stores, allowing developers to use alternative backends like SQLite, remote web services, or JSON files. This flexibility is enhanced by the new datastore protocol, which supports any persistence backend.
-
History API: The new SwiftData history feature allows apps to track modifications to their data, which is useful for syncing with servers or responding to changes from app extensions.
-
Class Inheritance: New in iOS 26, SwiftData supports class inheritance, allowing developers to build model graphs that harness inheritance, which is useful for models that form a natural hierarchy.
-
Indexing and Unique Constraints: The addition of index and unique constraints helps make queries more efficient and ensures data integrity by preventing duplicate entries.
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:01:52).

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.