is there any new updates in iOS 18 related to CoreData?
Asked on 08/07/2024
1 search
Yes, there are updates in iOS 18 related to CoreData. Specifically, SwiftData, which was introduced in iOS 17, now includes expanded capabilities that integrate with CoreData. Here are some of the key updates:
-
Custom Data Stores: SwiftData now allows you to use custom data stores, which means you can store data using alternative backends like SQLite, a remote web service, or even a mapped collection of JSON files. By default, SwiftData uses CoreData to store information, but this flexibility opens up new possibilities for data storage (Platforms State of the Union).
-
History Tracking: SwiftData provides access to the history of changes in a datastore, which is useful for tracking local changes that need to be synced to a remote web service. This feature can be particularly beneficial for those using CoreData's persistent history (Platforms State of the Union).
-
Migration to SwiftData History: For those using CoreData's persistent history, you can now migrate to SwiftData history, which supports all the features of history tracking by creating your own history types (Track model changes with SwiftData history).
For a deeper dive into these updates, you can check out the sessions:

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

Track model changes with SwiftData history
Reveal the history of your model’s changes with SwiftData! Use the history API to understand when data store changes occurred, and learn how to use this information to build features like remote server sync and out-of-process change handing in your app. We’ll also cover how you can build support for the history API into a custom data store.