What’s new in swiftdata?

Asked on 06/11/2025

1 search

In the "What's new in SwiftData" session at WWDC 2024, several new features and improvements were introduced for SwiftData. Here are the highlights:

  1. Schema Macro: A new schema macro helps avoid duplicate models, making it easier to manage your data models efficiently.

  2. Model Containers: There are new ways to set up and configure model containers, which are crucial for managing how data is stored and accessed in your app.

  3. Query Optimization: The session covered how to optimize queries with complex filters and introduced a new macro to improve performance.

  4. Custom Data Stores: SwiftData now supports custom data stores, allowing you to use alternative backends like SQLite, a remote web service, or even JSON files. This flexibility opens up new possibilities for data storage.

  5. Index and Unique Constraints: The addition of index and unique constraints helps make queries more efficient and ensures data integrity by preventing duplicate entries.

  6. SwiftData History: A new history API allows tracking of changes in the data store, which is useful for syncing with remote services or responding to changes from app extensions.

For more detailed information, you can refer to the session What’s new in SwiftData (00:00:07).