Class

NSAtomicStore

NSAtomicStore is an abstract superclass that you can subclass to create a Core Data atomic store. It provides default implementations of some utility methods. You use a custom atomic store if you have a custom file format that you want to integrate with a Core Data application.

Overview

The atomic stores are all intended to handle data sets that can be expressed in memory. The atomic store API favors simplicity over performance.

Subclassing Notes

Methods to Override

In a subclass of NSAtomicStore, you must override the following methods to provide behavior appropriate for your store:

These are in addition to the methods you must override for a subclass of NSPersistentStore:

Symbols

Loading a Store

func load()

Loads the cache nodes for the receiver.

func objectID(for: NSEntityDescription, withReferenceObject: Any)

Returns a managed object ID from the reference data for a specified entity.

func addCacheNodes(Set<NSAtomicStoreCacheNode>)

Registers a set of cache nodes with the receiver.

Updating Cache Nodes

func newCacheNode(for: NSManagedObject)

Returns a new cache node for a given managed object.

func newReferenceObject(for: NSManagedObject)

Returns a new reference object for a given managed object.

func updateCacheNode(NSAtomicStoreCacheNode, from: NSManagedObject)

Updates the given cache node using the values in a given managed object.

func willRemoveCacheNodes(Set<NSAtomicStoreCacheNode>)

Method invoked before the store removes the given collection of cache nodes.

Saving a Store

func save()

Saves the cache nodes.

Utility Methods

func cacheNodes()

Returns the set of cache nodes registered with the receiver.

func cacheNode(for: NSManagedObjectID)

Returns the cache node for a given managed object ID.

func referenceObject(for: NSManagedObjectID)

Returns the reference object for a given managed object ID.

Relationships

Inherits From