Swiftpack.co -  johnfairh/TMLPersistentContainer as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Shortest-path multi-step Core Data migrations in Swift
.package(url: "https://github.com/johnfairh/TMLPersistentContainer.git", from: "5.0.1")


CI codecov Pod Carthage compatible Platforms License

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.


Minimally replace the call to NSPersistentContainer.init or NSPersistentCloudKitContainer:

container = PersistentCloudKitContainer(name: "MyStore",
                                        managedObjectModel: model)

Additional parameters optionally enable more features:

container = PersistentContainer(name: "MyStore",
                                managedObjectModel: model,
                                bundles: [Bundle.main, myResBundle],
                                modelVersionOrder: .list("V_One", "V_Two", "V_Six"),
                                logMessageHandler: myLogHandler)
container.migrationDelegate = self

All migrations happen as part of NSPersistentContainer.loadPersistentStores.



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

No additional software dependencies.



pod 'TMLPersistentContainer'

Swift package manager:

.Package(url: "https://github.com/johnfairh/TMLPersistentContainer/", majorVersion: 5)


github "johnfairh/TMLPersistentContainer"


Contributions and feedback welcome: open an issue / johnfairh@gmail.com / twitter @johnfairh


Distributed under the ISC license.


Stars: 14
Last commit: 5 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

49 weeks ago

Bug Fixes

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API