---
title: "value(forKey:)"
framework: objectivec
role: symbol
role_heading: Instance Method
path: "objectivec/nsobject-swift.class/value(forkey:)"
---

# value(forKey:)

Returns the value for the property identified by a given key.

## Declaration

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

## Parameters

- `key`: The name of one of the receiver’s properties.

## Return Value

Return Value The value for the property identified by key.

## Discussion

Discussion The search pattern that valueForKey: uses to find the correct value to return is described in Accessor Search Patterns in Key-Value Coding Programming Guide.

## See Also

### Related Documentation

- [Key-Value Coding Programming Guide](apple-archive/documentation/Cocoa/Conceptual/KeyValueCoding.md)

### Getting Values

- [value(forKeyPath:)](objectivec/nsobject-swift.class/value(forkeypath:).md)
- [dictionaryWithValues(forKeys:)](objectivec/nsobject-swift.class/dictionarywithvalues(forkeys:).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)
