Instance Method


Creates or loads the document’s persistent store.


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



The URL for the persistent store.


The document’s file type.


The managed object model configuration to use.


The options used to configure the persistent store coordinator.


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

Return Value

true if configuration is successful, otherwise false.


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.