# `GSLayer attributeForKey:`

*Instance Method*

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

## Declaration

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

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

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

## See Also

### Attributes

- [`GSLayer.attributes`](/Core/GlyphsCore/GSLayer/attributes) — Values that configure layer behavior and special layer formats.
- [`GSLayer countOfAttributes`](/Core/GlyphsCore/GSLayer/countOfAttributes) — The number of attributes.
- [`GSLayer setAttributesFast:`](/Core/GlyphsCore/GSLayer/setAttributesFast:) — Replaces all attributes without registering undo or notifying the glyph.
- [`GSLayer setAttribute:forKey:`](/Core/GlyphsCore/GSLayer/setAttribute:forKey:) — Sets or removes an attribute.
- [`GSLayer setAttributeFast:forKey:`](/Core/GlyphsCore/GSLayer/setAttributeFast:forKey:) — Sets an attribute without registering undo or notifying the glyph.
- [`GSLayer removeAttributeForKey:`](/Core/GlyphsCore/GSLayer/removeAttributeForKey:) — Removes an attribute.

