<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "ObjectiveC",
  "identifier" : "/documentation/ObjectiveC/NSObject-swift.class/setValuesForKeys(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Objective-C Runtime",
      "ObjectiveC"
    ],
    "preciseIdentifier" : "c:objc(cs)NSObject(im)setValuesForKeysWithDictionary:"
  },
  "title" : "setValuesForKeys(_:)"
}
-->

# setValuesForKeys(_:)

Sets properties of the receiver with values from a given dictionary, using its keys to identify the properties.

```
func setValuesForKeys(_ keyedValues: [String : Any])
```

## Parameters

`keyedValues`

A dictionary whose keys identify properties in the receiver. The values of the properties in the receiver are set to the corresponding values in the dictionary.

## Discussion

The default implementation invokes [`setValue(_:forKey:)`](/documentation/ObjectiveC/NSObject-swift.class/setValue(_:forKey:)) for each key-value pair, substituting `nil` for `NSNull` values in `keyedValues`.

## See Also

[`dictionaryWithValues(forKeys:)`](/documentation/ObjectiveC/NSObject-swift.class/dictionaryWithValues(forKeys:))

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



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)