# `GSPath.segments`

*Instance Property*

The path represented as path segments.

## Declaration

```swift
var segments: [GSPathSegment] { get set }
```

```objc
@property (nonatomic, strong) NSArray<GSPathSegment *> * segments;
```

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

```python
pyobjc_instanceMethods.segments() -> list[GSPathSegment]
pyobjc_instanceMethods.setSegments_(segments: list[GSPathSegment])
```

## Discussion

A segment runs from one on-curve node to the next on-curve node. Off-curve nodes between them become control points of the segment.

Setting this property replaces the path nodes with nodes reconstructed from the segments.

> **Precondition**
> Setting an empty array is an error.

## See Also

### Segments

- [`GSPath.segmentsFast`](/Core/GlyphsCore/GSPath/segmentsFast) — The path represented as path segments without collecting path object information.
- [`GSPath segmentAtNodeIndex:`](/Core/GlyphsCore/GSPath/segmentAtNodeIndex:) — The segment associated with a node index.
- [`GSPath segmentAtNodeIndex:segmentStartIndex:segmentEndIndex:`](/Core/GlyphsCore/GSPath/segmentAtNodeIndex:segmentStartIndex:segmentEndIndex:) — The segment associated with a node index and the node index range it covers.

