---
title: "value(forAttribute:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsmetadataitem/value(forattribute:)"
---

# value(forAttribute:)

Returns the receiver’s metadata attribute name specified by a given key.

## Declaration

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

## Parameters

- `key`: The name of a metadata attribute. See the “Constants” section for a list of possible keys.

## Return Value

Return Value The receiver’s metadata attribute name specified by key.

## See Also

### Getting Item Attributes

- [attributes](foundation/nsmetadataitem/attributes.md)
- [values(forAttributes:)](foundation/nsmetadataitem/values(forattributes:).md)
