Contents

setURL(_:for:)

Changes the location of the specified persistent store.

Declaration

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

Parameters

  • url:

    The new location for store.

  • store:

    A persistent store associated with the receiver.

Return Value

true if the store was relocated, otherwise false.

Discussion

For atomic stores, this method alters the location to which the next save operation will write the file; for non-atomic stores, invoking this method will relinquish the existing connection and create a new one at the specified URL. (For non-atomic stores, a store must already exist at the destination URL; a new store will not be created.)

See Also

Managing a store’s location