Merge Policies

Define standard ways to handle conflicts during a save operation.

Overview

NSErrorMergePolicy is the default policy. It is the only policy that requires action to correct any conflicts. The other policies make a save go through silently by making changes that follow rules specific to that policy.

Topics

Policies

var NSErrorMergePolicy: AnyObject

Default policy for all managed object contexts.

var NSMergeByPropertyStoreTrumpMergePolicy: AnyObject

A policy that merges conflicts between the persistent store's version of the object and the current in-memory version by individual property, with the in-memory changes trumping external changes.

var NSMergeByPropertyObjectTrumpMergePolicy: AnyObject

A policy that merges conflicts between the persistent store's version of the object and the current in-memory version by individual property, with the external changes trumping in-memory changes.

var NSOverwriteMergePolicy: AnyObject

A policy that merges conflicts between the persistent store's version of the object and the current in-memory version by pushing the entire in-memory object to the persistent store.

var NSRollbackMergePolicy: AnyObject

A policy that merges conflicts between the persistent store's version of the object and the current in-memory version by discarding all state for the changed objects in conflict.

enum NSMergePolicyType

Constants that define merge policy types.

See Also

Defining Merge Policies

class var error: NSMergePolicy

Default policy for all managed object contexts.

class var mergeByPropertyObjectTrump: NSMergePolicy

A policy that merges conflicts between the persistent store's version of the object and the current in-memory version by individual property, with the external changes trumping in-memory changes.

class var mergeByPropertyStoreTrump: NSMergePolicy

A policy that merges conflicts between the persistent store's version of the object and the current in-memory version by individual property, with the in-memory changes trumping external changes.

class var overwrite: NSMergePolicy

A policy that merges conflicts between the persistent store's version of the object and the current in-memory version by pushing the entire in-memory object to the persistent store.

class var rollback: NSMergePolicy

A policy that merges conflicts between the persistent store's version of the object and the current in-memory version by discarding all state for the changed objects in conflict.