any changes to swiftdata?
Asked on 06/11/2025
1 search
At WWDC 2024, several updates and new features were introduced for SwiftData. Here are some of the key changes:
-
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 enables the use of SwiftData's API with various storage solutions (Create a custom data store with SwiftData).
-
Schema Customization: New macros have been introduced to avoid duplicate models and optimize queries. The
#Unique
macro helps ensure models are not duplicated, and the#Index
macro makes queries more efficient by optimizing how properties are stored and retrieved (What’s new in SwiftData). -
History API: SwiftData now includes a history API that allows apps to track changes over time, such as insertions, updates, and deletions. This is useful for syncing with remote services or tracking changes across different app processes (Track model changes with SwiftData history).
-
Inheritance and Schema Migration: SwiftData supports class inheritance and provides strategies for schema migration, ensuring data is preserved and managed efficiently as the app evolves (SwiftData: Dive into inheritance and schema migration).
These updates enhance the flexibility, efficiency, and capability of SwiftData, making it a more powerful tool for app data management across Apple's platforms.

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.

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.

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