Automatic shortest-path multi-step Core Data migrations in Swift.
A set of Swift extensions to Core Data’s NSPersistentContainer and
NSPersistentCloudKitContainer that automatically detect and perform
multi-step store migration using the shortest valid sequence of migrations.
The library supports both light-weight and heavy-weight migrations, multiple
stores, progress reporting, and configurable logging.
Example
Minimally replace the call to NSPersistentContainer.init or
NSPersistentCloudKitContainer:
Read TestSimpleMigrate.testCanMigrateV1toV3inTwoSteps for an end-to-end
example.
Requirements
Swift 5 or later, Xcode 10.2 or later.
See the swift31 branch for a Swift 31 version.
See the swift4 branch for a Swift 4 version.
See the swift41 branch for a Swift 4.1 version.
The library is based on NSPersistentContainer so requires a minimum
deployment target of iOS 10.0, macOS 10.12, tvOS 10.0, or watchOS 3.0.
The PersistentCloudKitContainer class is based on
NSPersistentCloudKitContainer so further requires a minimum deployment target
of iOS 13.0, macOS 10.15, tvOS 13.0, or watchOS 6.0.`
TMLPersistentContainer
Automatic shortest-path multi-step Core Data migrations in Swift.
A set of Swift extensions to Core Data’s
NSPersistentContainer
andNSPersistentCloudKitContainer
that automatically detect and perform multi-step store migration using the shortest valid sequence of migrations. The library supports both light-weight and heavy-weight migrations, multiple stores, progress reporting, and configurable logging.Example
Minimally replace the call to
NSPersistentContainer.init
orNSPersistentCloudKitContainer
:Additional parameters optionally enable more features:
All migrations happen as part of
NSPersistentContainer.loadPersistentStores
.Documentation
TestSimpleMigrate.testCanMigrateV1toV3inTwoSteps
for an end-to-end example.Requirements
Swift 5 or later, Xcode 10.2 or later.
The library is based on
NSPersistentContainer
so requires a minimum deployment target of iOS 10.0, macOS 10.12, tvOS 10.0, or watchOS 3.0.The
PersistentCloudKitContainer
class is based onNSPersistentCloudKitContainer
so further requires a minimum deployment target of iOS 13.0, macOS 10.15, tvOS 13.0, or watchOS 6.0.`No additional software dependencies.
Installation
CocoaPods:
Swift package manager:
Carthage:
Contributions
Contributions and feedback welcome: open an issue / johnfairh@gmail.com / @johnfairh@mastodon.social
License
Distributed under the ISC license.