---
title: "dictionaryWithValues(forKeys:)"
framework: objectivec
role: symbol
role_heading: Instance Method
path: "objectivec/nsobject-swift.class/dictionarywithvalues(forkeys:)"
---

# dictionaryWithValues(forKeys:)

Returns a dictionary containing the property values identified by each of the keys in a given array.

## Declaration

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

## Parameters

- `keys`: An array containing NSString objects that identify properties of the receiver.

## Return Value

Return Value A dictionary containing as keys the property names in keys, with corresponding values being the corresponding property values.

## Discussion

Discussion The default implementation invokes value(forKey:) for each key in keys and substitutes NSNull values in the dictionary for returned nil values.

## See Also

### Related Documentation

- [setValuesForKeys(_:)](objectivec/nsobject-swift.class/setvaluesforkeys(_:).md)

### Getting Values

- [value(forKey:)](objectivec/nsobject-swift.class/value(forkey:).md)
- [value(forKeyPath:)](objectivec/nsobject-swift.class/value(forkeypath:).md)
- [value(forUndefinedKey:)](objectivec/nsobject-swift.class/value(forundefinedkey:).md)
- [mutableArrayValue(forKey:)](objectivec/nsobject-swift.class/mutablearrayvalue(forkey:).md)
- [mutableArrayValue(forKeyPath:)](objectivec/nsobject-swift.class/mutablearrayvalue(forkeypath:).md)
- [mutableSetValue(forKey:)](objectivec/nsobject-swift.class/mutablesetvalue(forkey:).md)
- [mutableSetValue(forKeyPath:)](objectivec/nsobject-swift.class/mutablesetvalue(forkeypath:).md)
- [mutableOrderedSetValue(forKey:)](objectivec/nsobject-swift.class/mutableorderedsetvalue(forkey:).md)
- [mutableOrderedSetValue(forKeyPath:)](objectivec/nsobject-swift.class/mutableorderedsetvalue(forkeypath:).md)
