# `GSLayer transform:checkForSelection:doComponent:`

*Instance Method*

Applies an affine transform to editable layer content and conditionally transforms components.

## Declaration

```swift
func transform(_ transform: AffineTransform, checkForSelection: Bool, doComponent componentCallback: ((GSComponent?) -> Bool)? = nil)
```

```objc
- (void) transform:(NSAffineTransform *) transform checkForSelection:(BOOL) checkForSelection doComponent:(BOOL (^)(GSComponent *component)) componentCallback;
```

```python
transform_checkForSelection_doComponent_(transform: NSAffineTransform, checkForSelection: bool, component: GSComponent, componentCallback)
```

## Parameters

- `checkForSelection` — Whether to restrict the operation to selected elements when the selection is not empty.
- `componentCallback` — A block that returns whether a component or component hint should be transformed.

## See Also

### General Transformations

- [`GSLayer transformSelection:`](/Core/GlyphsCore/GSLayer/transformSelection:) — Applies an affine transform to the selected elements.
- [`GSLayer transform:checkForSelection:`](/Core/GlyphsCore/GSLayer/transform:checkForSelection:) — Applies an affine transform to editable layer content.
- [`GSLayer transform:checkForSelection:doComponents:`](/Core/GlyphsCore/GSLayer/transform:checkForSelection:doComponents:) — Applies an affine transform to editable layer content.
- [`GSLayer transformFast:`](/Core/GlyphsCore/GSLayer/transformFast:) — Applies an affine transform to the complete layer without normal edit bookkeeping.
- [`GSLayer transformFast:doComponent:`](/Core/GlyphsCore/GSLayer/transformFast:doComponent:) — Applies an affine transform to the complete layer and conditionally transforms components without normal edit bookkeeping.

