Instance Method

configurePersistentStoreCoordinator(for:ofType:modelConfiguration:storeOptions:)

Creates or loads the document’s persistent store.

Declaration

func configurePersistentStoreCoordinator(for storeURL: URL, ofType fileType: String, modelConfiguration configuration: String?, storeOptions: [AnyHashable : Any]? = nil) throws

Parameters

storeURL

The URL for the persistent store.

fileType

The document’s file type.

configuration

The managed object model configuration to use.

storeOptions

The options used to configure the persistent store coordinator.

error

Upon return, if a problem occurs, contains an error object that describes the problem.

Return Value

true if configuration is successful, otherwise false.

Discussion

You can override this method if you want customize the creation or loading of the document’s persistent store. For example, you can perform post-migration clean-up—if your application needs to migrate store data to use a new version of the managed object model, you can override this method to make additional modifications to the store after migration.

See Also

Managing the Core Data Stack

var managedObjectContext: NSManagedObjectContext

The document’s managed object context.

var managedObjectModel: NSManagedObjectModel

The document’s managed object model.

var persistentStoreOptions: [AnyHashable : Any]?

Options used when creating the document’s persistent store.

var modelConfiguration: String?

A model configuration name to be passed when configuring the persistent store.

func persistentStoreType(forFileType: String) -> String

Returns the Core Data store type for a given document file type.