SwiftData updates
Learn about important changes to SwiftData.
Overview
Browse notable changes in SwiftData.
June 2025
Increase the flexibility of your models by adopting inheritance through the Model() macro.
Gain added flexibility in accessing and sorting transaction history using sortBy in the HistoryDescriptor.
June 2024
Macros
Improve performance of sorts and predicate-based fetches by using the Index(_:) macro to define individual and compound indexes.
Define a unique constraint that includes one or more model attributes using the Unique(_:) macro, enabling SwiftData to regard tuples of attributes as unique.
Specify
nilas a relationship’sinverseto create a unidirectional relationship.
Persistent history
Fetch historical changes for one or more persistent models using the model context’s fetchHistory(_:) method.
Delete stale model history from a persistent store by calling the context’s deleteHistory(_:) method.
Provide an alternate change tracking strategy for your custom persistent store by adopting the HistoryProviding protocol.
Custom persistent stores
Adopt the DataStore protocol (and related protocols) to provide custom storage for your app’s persistent models.
See Also
Technology updates
Accelerate updatesAccessibility updatesActivityKit updatesAdAttributionKit UpdatesApp Clips updatesApp Intents updatesAppKit updatesApple Intelligence updatesAppleMapsServerAPI UpdatesApple Pencil updatesARKit updatesAudio Toolbox updatesAuthenticationServices updatesAVFAudio updatesAVFoundation updates