Contents

committedValues(forKeys:)

Returns a dictionary of the most recent fetched or saved values of the managed object for the properties of the specified keys.

Declaration

func committedValues(forKeys keys: [String]?) -> [String : Any]

Parameters

  • keys:

    An array containing names of properties of the receiver, or nil.

Return Value

A dictionary containing the last fetched or saved values of the receiver for the properties specified by keys.

Discussion

nil values are represented by an instance of NSNull.

This method only reports values of properties that are defined as persistent properties of the receiver, not values of transient properties or of custom instance variables.

You can invoke this method with the keys value of nil to retrieve committed values for all the receiver’s properties, as illustrated by the following example.

NSDictionary *allCommittedValues =
        [aManagedObject committedValuesForKeys:nil];

It is more efficient to use nil than to pass an array of all the property keys.

See Also

Managing Change Events