# `GSComponent.anchor`

*Instance Property*

The base anchor name to use for automatic attachment.

## Declaration

```swift
var anchor: String? { get set }
```

```objc
@property (nonatomic, strong) NSString * anchor;
```

[See also `anchor` in the Python API](https://docu.glyphsapp.com/#GSComponent.anchor)

```python
pyobjc_instanceMethods.anchor() -> str
pyobjc_instanceMethods.setAnchor_(anchor: str)
```

## Discussion

The corresponding anchor in the component layer normally has the same name prefixed with an underscore. `nil` selects a matching anchor pair automatically.

## See Also

### Attachment

- [`GSComponent.doesAttach`](/Core/GlyphsCore/GSComponent/doesAttach) — Whether the component participates in automatic anchor attachment under the current policy.
- [`GSComponent.shouldAttach`](/Core/GlyphsCore/GSComponent/shouldAttach) — Whether the component normally qualifies for automatic anchor attachment.
- [`GSComponent.traverseAnchors`](/Core/GlyphsCore/GSComponent/traverseAnchors) — Whether anchor traversal includes anchors from the component layer.

