Any changes to swift data this year
Asked on 2025-06-15
1 search
This year, there have been several updates to Swift Data, as highlighted in the WWDC sessions:
-
Modeling Enhancements: Swift Data now includes a more flexible model subclassing, entity inheritance, and support for additional common data types like
AttributedString
. These enhancements make it easier to define and manage data models in Swift. -
Schema and Indexing: New features such as the
#Unique
macro and#Index
macro have been introduced. The#Index
macro helps make queries more efficient by optimizing how properties are stored and retrieved, while the#Unique
macro ensures that a set of properties has no duplicate entries. -
Custom Data Stores: Swift Data now supports custom data stores, allowing developers to use alternative backends like SQLite, remote web services, or JSON files. This flexibility enables the use of Swift Data's API with a variety of storage solutions.
-
History API: The new history API allows developers to track changes in a datastore, which is useful for synchronizing local changes with remote services.
-
Performance Improvements: There are optimizations for query performance, including complex filters and a new macro to improve performance.
For more detailed information, you can refer to the session What’s new in SwiftData (00:00:00).

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

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