# `GSLayer.shapes`

*Instance Property*

An array of the shape objects defining the visual part of the layer.

## Declaration

```swift
var shapes: [GSShape] { get set }
```

```objc
@property (nonatomic, strong) NSArray<GSShape *> * shapes;
```

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

```python
pyobjc_instanceMethods.shapes() -> list[GSShape]
pyobjc_instanceMethods.setShapes_(shapes: list[GSShape])
```

## Discussion

This is a linear representation of the shapes of the layer with the elements in stacking order from bottom to top. This array also contains shape group objects which are used to create a shape tree structure. When processing the shapes of a layer while respecting this shape hierarchy, use the `rootGroup` property instead.

## See Also

### Shapes

- [`GSLayer setShapesFast:`](/Core/GlyphsCore/GSLayer/setShapesFast:) — Replaces the shapes without undo registration or KVO notifications.
- [`GSLayer setShapes:hints:`](/Core/GlyphsCore/GSLayer/setShapes:hints:) — Replaces the shapes and hints together.
- [`GSLayer getCopyOfContentFromLayer:doSelection:`](/Core/GlyphsCore/GSLayer/getCopyOfContentFromLayer:doSelection:) — Copies shapes, hints, anchors, and optionally selected nodes from another layer.
- [`GSLayer countOfShapes`](/Core/GlyphsCore/GSLayer/countOfShapes) — The number of shapes in the layer.
- [`GSLayer indexOfObjectInShapes:`](/Core/GlyphsCore/GSLayer/indexOfObjectInShapes:) — Returns the linear shape index of a shape.
- [`GSLayer objectInShapesAtIndex:`](/Core/GlyphsCore/GSLayer/objectInShapesAtIndex:) — Returns the shape at the given linear shape index.
- [`GSLayer objectInShapesAtIndexFast:`](/Core/GlyphsCore/GSLayer/objectInShapesAtIndexFast:) — Returns the shape at the given linear shape index without locking.
- [`GSLayer clear`](/Core/GlyphsCore/GSLayer/clear) — Removes shapes, anchors, hints, and selection from the layer.

