Store Options

Use options dictionary keys to specify store behavior and characteristics.

Topics

Constants

let NSReadOnlyPersistentStoreOption: String

A flag that indicates whether a store is treated as read-only or not.

let NSValidateXMLStoreOption: String

A flag that indicates whether an XML file should be validated with the DTD while opening.

let NSPersistentStoreTimeoutOption: String

Options key that specifies the connection timeout for Core Data stores.

let NSSQLitePragmasOption: String

Options key for a dictionary of SQLite pragma settings with pragma values indexed by pragma names as keys.

let NSSQLiteAnalyzeOption: String

Option key to run an analysis of the store data to optimize indices based on statistical information when the store is added to the coordinator.

let NSSQLiteManualVacuumOption: String

Option key to rebuild the store file, forcing a database wide defragmentation when the store is added to the coordinator.

let NSExternalRecordsDirectoryOption: String

Option indicating the directory where Spotlight external record files should be written to.

Deprecated
let NSExternalRecordExtensionOption: String

Option indicating the file extension to use for Spotlight external record files.

Deprecated
let NSExternalRecordsFileFormatOption: String

Option to specify the file format of a Spotlight external records.

Deprecated
let NSPersistentStoreFileProtectionKey: String

Key to represent the protection class for the persistent store.

let NSPersistentStoreUbiquitousContentNameKey: String

Option to specify that a persistent store has a given name in ubiquity.

Deprecated
let NSPersistentStoreUbiquitousContentURLKey: String

Option to specify the log path to use for ubiquitous content logs.

Deprecated
let NSPersistentStoreUbiquitousPeerTokenOption: String

The corresponding value is an optionally specified string which will be mixed in to Core Data’s identifier for each iCloud peer. The value must be an alphanumeric string without any special characters, whitespace or punctuation. The primary use for this option is to allow multiple applications on the same peer (device) to share a Core Data store integrated with iCloud. Each application will require its own store file.

Deprecated
let NSPersistentStoreRemoveUbiquitousMetadataOption: String

The corresponding value is an NSNumber object representing a boolean that indicates whether the receiver should remove all associated ubiquity metadata from a persistent store. You typically use this option during migration or copying to disassociate a persistent store file from an iCloud account.

Deprecated
let NSPersistentStoreUbiquitousContainerIdentifierKey: String

The corresponding value is a string specifying the iCloud container identifier Core Data should pass to url(forUbiquityContainerIdentifier:).

Deprecated
let NSPersistentStoreRebuildFromUbiquitousContentOption: String

The corresponding value is an NSNumber object representing a boolean that indicates whether the receiver should erase the local store file and rebuild it from the iCloud data in Mobile Documents.

Deprecated

See Also

Configuring Persistent Stores

func addPersistentStore(ofType: String, configurationName: String?, at: URL?, options: [AnyHashable : Any]?) -> NSPersistentStore

Adds a new persistent store of a specified type at a given location, and returns the new store.

func setURL(URL, for: NSPersistentStore) -> Bool

Sets the URL for a given persistent store.

func remove(NSPersistentStore)

Removes a given persistent store.

func destroyPersistentStore(at: URL, ofType: String, options: [AnyHashable : Any]?)

Deletes (or truncates) the target persistent store in accordance with the store class' requirements.

var persistentStores: [NSPersistentStore]

The persistent stores associated with the coordinator.

func persistentStore(for: URL) -> NSPersistentStore?

Returns the persistent store for the specified URL.

func url(for: NSPersistentStore) -> URL

Returns the URL for a given persistent store.

var name: String?

Name of the coordinator.