# `GSNode attributeForKey:`

*Instance Method*

The value for an attribute key, or `nil` if no value is set.

## Declaration

```swift
func attribute(forKey key: GSShapeKey) -> Any?
```

```objc
- (id) attributeForKey:(GSShapeKey) key;
```

```python
attributeForKey_(key: GSShapeKey) -> object
```

## See Also

### Attributes

- [`GSNode.attributes`](/Core/GlyphsCore/GSNode/attributes) — Additional values associated with the node.
- [`GSNode.countOfAttributes`](/Core/GlyphsCore/GSNode/countOfAttributes) — The number of attributes.
- [`GSNode setAttribute:forKey:`](/Core/GlyphsCore/GSNode/setAttribute:forKey:) — Sets or removes an attribute.
- [`GSNode setAttributes:format:`](/Core/GlyphsCore/GSNode/setAttributes:format:) — Replaces all attributes using values encoded for a file format version.
- [`GSNode setAttributesFast:format:`](/Core/GlyphsCore/GSNode/setAttributesFast:format:) — Replaces all attributes without registering undo or notifying the path.
- [`GSNode removeAttributeForKey:`](/Core/GlyphsCore/GSNode/removeAttributeForKey:) — Removes an attribute.

