---
title: "value(withUniqueID:inPropertyWithKey:)"
framework: objectivec
role: symbol
role_heading: Instance Method
path: "objectivec/nsobject-swift.class/value(withuniqueid:inpropertywithkey:)"
---

# value(withUniqueID:inPropertyWithKey:)

Retrieves an object by ID from the collection specified by the passed key.

## Declaration

```swift
func value(withUniqueID uniqueID: Any, inPropertyWithKey key: String) -> Any?
```

## Discussion

Discussion The method valueIn<Key>WithUniqueID: is invoked if it exists. Otherwise, raises an NSUndefinedKeyException. The declared type of uniqueID in the constructed method must be id, NSNumber *, NSString *, or one of the scalar types that can be encapsulated by NSNumber.

## See Also

### Access by name, key, or ID

- [insertValue(_:inPropertyWithKey:)](objectivec/nsobject-swift.class/insertvalue(_:inpropertywithkey:).md)
- [value(withName:inPropertyWithKey:)](objectivec/nsobject-swift.class/value(withname:inpropertywithkey:).md)
