---
title: "committedValues(forKeys:)"
framework: coredata
role: symbol
role_heading: Instance Method
path: "coredata/nsmanagedobject/committedvalues(forkeys:)"
---

# 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

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

## Parameters

- `keys`: An array containing names of properties of the receiver, or nil.

## Return Value

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

## Discussion

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

- [contextShouldIgnoreUnmodeledPropertyChanges](coredata/nsmanagedobject/contextshouldignoreunmodeledpropertychanges.md)
- [awakeFromFetch()](coredata/nsmanagedobject/awakefromfetch().md)
- [awakeFromInsert()](coredata/nsmanagedobject/awakefrominsert().md)
- [awake(fromSnapshotEvents:)](coredata/nsmanagedobject/awake(fromsnapshotevents:).md)
- [changedValues()](coredata/nsmanagedobject/changedvalues().md)
- [changedValuesForCurrentEvent()](coredata/nsmanagedobject/changedvaluesforcurrentevent().md)
- [prepareForDeletion()](coredata/nsmanagedobject/preparefordeletion().md)
- [willSave()](coredata/nsmanagedobject/willsave().md)
- [didSave()](coredata/nsmanagedobject/didsave().md)
- [willTurnIntoFault()](coredata/nsmanagedobject/willturnintofault().md)
- [didTurnIntoFault()](coredata/nsmanagedobject/didturnintofault().md)
- [fetchRequest()](coredata/nsmanagedobject/fetchrequest().md)
