# `GSGlyphEditView switchToLayerWithId:associatedMasterId:inRange:`

*Instance Method*

Switches to the layer with the given layer id for the given range of characters as in the original string.

## Declaration

```swift
func switchToLayer(withId layerId: String, associatedMasterId: String?, in range: NSRange)
```

```objc
- (void) switchToLayerWithId:(NSString *) layerId associatedMasterId:(NSString *) associatedMasterId inRange:(NSRange) range;
```

```python
switchToLayerWithId_associatedMasterId_inRange_(layerId: str, associatedMasterId: str, range: NSRange)
```

## Parameters

- `layerId` — The layer to switch to.
- `associatedMasterId` — If this argument is non-nil and the master id matches the id of the currently active master, the function will remove all layer id attributes from the text in the given range instead of setting new layer id attributes.
- `range` — The range in which to switch layers. The function switches no layers if the range extends past the text storage.

