<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreData",
  "identifier" : "/documentation/CoreData/NSAtomicStoreCacheNode/value(forKey:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "c:objc(cs)NSAtomicStoreCacheNode(im)valueForKey:"
  },
  "title" : "value(forKey:)"
}
-->

# value(forKey:)

Returns the value for a given key.

```
func value(forKey key: String) -> Any?
```

## Parameters

`key`

The name of a property.

## Return Value

The value for the property named `key`. For an attribute, the return value is an instance of an attribute type supported by Core Data (see [`NSAttributeDescription`](/documentation/CoreData/NSAttributeDescription)); for a to-one relationship, the return value must be another cache node instance; for a to-many relationship, the return value must be an collection of the related cache nodes.

## Discussion

The default implementation forwards the request to the [`propertyCache`](/documentation/CoreData/NSAtomicStoreCacheNode/propertyCache) dictionary if `key` matches a property name of the entity for the cache node. If `key` does not represent a property, the standard <doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class/value(forKey:)> implementation is used.

---

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)