---
title: "setValue(_:forKey:)"
framework: coredata
role: symbol
role_heading: Instance Method
path: "coredata/nsatomicstorecachenode/setvalue(_:forkey:)"
---

# setValue(_:forKey:)

Sets the value for the given key.

## Declaration

```swift
func setValue(_ value: Any?, forKey key: String)
```

## Parameters

- `value`: The value for the property identified by key.
- `key`: The name of a property.

## Discussion

Discussion The default implementation forwards the request to the propertyCache dictionary if key matches a property name of the entity for this cache node. If key does not represent a property, the standard setValue(_:forKey:) implementation is used.

## See Also

### Managing Node Data

- [objectID](coredata/nsatomicstorecachenode/objectid.md)
- [propertyCache](coredata/nsatomicstorecachenode/propertycache.md)
- [value(forKey:)](coredata/nsatomicstorecachenode/value(forkey:).md)
