What new in coredata

Asked on 2025-08-04

1 search

At WWDC 2024, several updates and features related to Core Data and Swift Data were introduced. Here are some of the key highlights:

  1. Swift Data Framework: Swift Data is a framework that allows you to model and persist your app's data across all of Apple's platforms. It provides persistence, modeling, and migration of your schema, graph management, and synchronization with CloudKit.

  2. Custom Data Stores: Swift Data now supports custom data stores, allowing you to use any document format or persistence backend of your choice. This flexibility means you can use Swift Data's API with backends like SQLite, a remote web service, or even JSON files.

  3. History API: A new history API was introduced to track changes to your app's models. This feature allows you to query for changes, such as insertions, updates, or deletions, and is useful for tracking local changes that need to be synced to a remote web service.

  4. Index and Unique Macros: The addition of index and unique macros helps make queries more efficient. The index macro allows you to specify which properties are commonly queried together, while the unique macro ensures that a set of properties has no duplicate entries.

  5. Swift Data History: For those using Core Data's persistent history, you can now migrate to Swift Data history, which provides a way to track model changes over time.

For more detailed information, you can refer to the session "What’s new in SwiftData" (03:37) which covers the history API and other new features in Swift Data.