Contents

johnfairh/tmlpersistentcontainer

TMLPersistentContainer

Example

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.

Documentation

API documentation online.

example.

Requirements

Swift 6 or later, Xcode 16 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. The minimum deployment targets are iOS 12.0, macOS 10.14.6, tvOS 12.0, and 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.

Installation

CocoaPods:

pod 'TMLPersistentContainer'

Swift package manager:

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

Carthage:

github "johnfairh/TMLPersistentContainer"

Contributions

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

License

Distributed under the ISC license.

Package Metadata

Repository: johnfairh/tmlpersistentcontainer

Default branch: main

README: README.md