# `GSGlyph layerGroupsInstances:masters:ignoreEmptyLayers:error:`

*Instance Method*

The layer identifier groups required by a set of instances.

## Declaration

```swift
func layerGroupsInstances(_ instances: [GSInstance]?, masters: [GSFontMaster]?, ignoreEmptyLayers: Bool, error: NSErrorPointer) -> [NSMutableOrderedSet]
```

```objc
- (NSArray<NSMutableOrderedSet<NSString *> *> *) layerGroupsInstances:(NSArray<GSInstance *> *) instances masters:(NSArray<GSFontMaster *> *) masters ignoreEmptyLayers:(BOOL) ignoreEmptyLayers error:(NSError **) error;
```

```python
layerGroupsInstances_masters_ignoreEmptyLayers_error_(instances: list[GSInstance], masters: list[GSFontMaster], ignoreEmptyLayers: bool) -> tuple[list[NSMutableOrderedSet<NSString *>], NSError]
```

## Parameters

- `instances` — The instances that determine which layers participate, or `nil` for forced grouping.
- `masters` — The font masters to consider and include when necessary.
- `ignoreEmptyLayers` — Whether to omit layers without content.
- `error` — On return, an error encountered while resolving the masters of a variable instance.

## Discussion

Passing `nil` for `instances` groups all active master, Intermediate, Alternative, and color layers independently of the font’s instances. Groups that share a layer identifier are combined.

## See Also

### Layer Groups

- [`GSGlyph layerGroups`](/Core/GlyphsCore/GSGlyph/layerGroups) — The layer identifier groups used to check compatibility and coordinate edits across corresponding layers.
- [`GSGlyph forcedLayerGroupIdsSeenLayers:ignoreEmptyLayers:`](/Core/GlyphsCore/GSGlyph/forcedLayerGroupIdsSeenLayers:ignoreEmptyLayers:) — The layer identifier groups formed without reference to configured instances.
- [`GSGlyph layerGroupIDSetForLayer:`](/Core/GlyphsCore/GSGlyph/layerGroupIDSetForLayer:) — The forced layer group containing a layer, or `nil` when the layer is not in a group.
- [`GSGlyph layerGroupIDSetForLayer:ignoreEmptyLayers:`](/Core/GlyphsCore/GSGlyph/layerGroupIDSetForLayer:ignoreEmptyLayers:) — The forced layer group containing a layer, or `nil` when the layer is not in a group.
- [`GSGlyph layerGroupIDsForLayer:`](/Core/GlyphsCore/GSGlyph/layerGroupIDsForLayer:) — The forced layer group containing a layer as an array, or `nil` when the layer is not in a group.
- [`GSGlyph compatibleLayerGroupIdsForLayer:`](/Core/GlyphsCore/GSGlyph/compatibleLayerGroupIdsForLayer:) — The identifiers of layers in the same group that have compatible shapes, anchors, and path-component hints.
- [`GSGlyph collectBraceLayerIDsMasters:allKeys:`](/Core/GlyphsCore/GSGlyph/collectBraceLayerIDsMasters:allKeys:) — The font masters including representations of active Intermediate-layer locations.

