Class

NSPersistent​Store

This class is the abstract base class for all Core Data persistent stores.

Overview

Core Data provides four store types—SQLite, Binary, XML, and In-Memory (the XML store is not available on iOS); these are described in Persistent Store Features. Core Data also provides subclasses of NSPersistent​Store that you can use to define your own store types: NSAtomic​Store and NSIncremental​Store. The Binary and XML stores are examples of atomic stores that inherit functionality from NSAtomic​Store.

Subclassing Notes

You should not subclass NSPersistent​Store directly. Core Data only supports subclassing of NSAtomic​Store and NSIncremental​Store.

The designated initializer is init(persistent​Store​Coordinator:​configuration​Name:​at:​options:​). When you implement the initializer, you must ensure you load metadata during initialization and set it using metadata.

You must override these methods:

Symbols

Working with State Information

var type:​ String

The type string of the receiver.

var persistent​Store​Coordinator:​ NSPersistent​Store​Coordinator?

The persistent store coordinator that loaded the receiver.

var configuration​Name:​ String

The name of the managed object model configuration used to create the receiver.

var options:​ [Any​Hashable :​ Any]?

The options the store was initialized with.

var url:​ URL?

The URL for the receiver.

var identifier:​ String!

The unique identifier for the receiver.

var is​Read​Only:​ Bool

A Boolean value that indicates whether the receiver is read-only.

Managing Metadata

class func metadata​For​Persistent​Store(with:​ URL)

Returns the metadata from the persistent store at the given URL.

var metadata:​ [String :​ Any]!

The metadata for the receiver.

func load​Metadata()

Instructs the receiver to load its metadata.

Setup and Teardown

func did​Add(to:​ NSPersistent​Store​Coordinator)

Invoked after the receiver has been added to the persistent store coordinator.

func will​Remove(from:​ NSPersistent​Store​Coordinator?)

Invoked before the receiver is removed from the persistent store coordinator.

Supporting Migration

class func migration​Manager​Class()

Returns the NSMigration​Manager class for this store class.

Relationships

Inherits From