# `GSGlyph nearestMaster(from:alongAxisAt:towardHigherValues:)`

*Instance Method*

The nearest font master in one direction along an axis, or `nil` when none exists.

## Declaration

```swift
func nearestMaster(from location: [CGFloat], alongAxisAt axisIndex: Int, towardHigherValues: Bool) -> (masterID: String, position: CGFloat)?
```

## Parameters

- `location` — One internal coordinate for each font axis, in font axis order.
- `axisIndex` — The index of the axis along which to search.
- `towardHigherValues` — Whether to search toward greater rather than smaller coordinates.

## Discussion

Font masters at the same coordinates on every other axis are considered. Returns `nil` when the coordinate count or axis index does not match the font axes.

## 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 interpolatedLayer(for:masters:scale:keepSmart:smartSettings:layerName:)`](/Core/GlyphsCore/GSGlyph/interpolatedLayer(for:masters:scale:keepSmart:smartSettings:layerName:)) — A detached layer interpolated for an instance together with its additional 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 replaceLayersWithInterpolation:error:`](/Core/GlyphsCore/GSGlyph/replaceLayersWithInterpolation:error:) — Replaces layer contents with interpolation from the remaining layers in each layer group.

