# `GSGlyph replaceLayersWithInterpolation:error:`

*Instance Method*

Replaces layer contents with interpolation from the remaining layers in each layer group.

## Declaration

```swift
func replaceLayers(withInterpolation layers: [GSLayer], error: ()) throws
```

```objc
- (BOOL) replaceLayersWithInterpolation:(NSArray<GSLayer *> *) layers error:(NSError **) error;
```

```python
replaceLayersWithInterpolation_error_(layers: list[GSLayer]) -> tuple[bool, NSError]
```

## Parameters

- `layers` — The layers belonging to the glyph that are recalculated.
- `error` — On return, an error that prevented recalculation.

## Return Value

Whether all requested layers were recalculated.

## Discussion

Use this to recalculate Intermediate layers or restore font master layers from the other masters.

## See Also

### Interpolation

- [`GSGlyph interpolate:masters:error:`](/Core/GlyphsCore/GSGlyph/interpolate:masters:error:) — A detached layer formed by applying interpolation coefficients to compatible source layers.
- [`GSGlyph interpolateSmartLayer:instance:scale:targetGlyph:`](/Core/GlyphsCore/GSGlyph/interpolateSmartLayer:instance:scale:targetGlyph:) — Adds the corresponding interpolated Smart Component layers to a target glyph.
- [`GSGlyph nextLayerId:layerPos:onAxis:direction:`](/Core/GlyphsCore/GSGlyph/nextLayerId:layerPos:onAxis:direction:) — Finds the nearest font master in one direction along an axis while keeping the other axis coordinates fixed.

