# `GSShape transform:selection:`

*Instance Method*

Applies an affine transformation to selected elements of the shape.

## Declaration

```swift
func transform(_ transform: AffineTransform, selection: NSOrderedSet?)
```

```objc
- (void) transform:(NSAffineTransform *) transform selection:(NSOrderedSet *) selection;
```

```python
transform_selection_(transform: NSAffineTransform, selection: NSOrderedSet)
```

## Parameters

- `selection` — The elements to transform, or `nil` for the complete shape.

## Discussion

A path selection contains nodes, while a transformable shape selection contains the shape itself. Pass `nil` to transform the complete shape.

## See Also

### Geometry

- [`GSShape transform:`](/Core/GlyphsCore/GSShape/transform:) — Applies an affine transformation to the complete shape.
- [`GSShape transformFast:grid:`](/Core/GlyphsCore/GSShape/transformFast:grid:) — Applies an affine transformation and aligns the resulting coordinates to a grid without registering undo or notifying the layer.
- [`GSShape moveWithPoint:`](/Core/GlyphsCore/GSShape/moveWithPoint:) — Translates the complete shape by an offset.
- [`GSShape getPositionsFromShape:`](/Core/GlyphsCore/GSShape/getPositionsFromShape:) — Copies corresponding positions and transformation values from another shape.

