# `GSFont replaceObjectInInstancesAtIndex:withObject:`

*Instance Method*

Replaces the instance at an index.

## Declaration

```swift
func replaceInstance(at idx: UInt, with instance: GSInstance)
```

```objc
- (void) replaceObjectInInstancesAtIndex:(NSUInteger) idx withObject:(GSInstance *) instance;
```

```python
replaceObjectInInstancesAtIndex_withObject_(idx: int, instance: GSInstance)
```

## See Also

### Instances

- [`GSFont.instances`](/Core/GlyphsCore/GSFont/instances) — Export configurations of the font.
- [`GSFont countOfInstances`](/Core/GlyphsCore/GSFont/countOfInstances) — The number of instances in the font.
- [`GSFont objectInInstancesAtIndex:`](/Core/GlyphsCore/GSFont/objectInInstancesAtIndex:) — Returns the instance at an index, or `nil` when the index is out of range.
- [`GSFont insertObject:inInstancesAtIndex:`](/Core/GlyphsCore/GSFont/insertObject:inInstancesAtIndex:) — Inserts an instance at an index.
- [`GSFont insertInstance:atIndex:`](/Core/GlyphsCore/GSFont/insertInstance:atIndex:) — Inserts an instance at an index.
- [`GSFont addInstance:`](/Core/GlyphsCore/GSFont/addInstance:) — Adds an instance to the font.
- [`GSFont addInstanceFast:`](/Core/GlyphsCore/GSFont/addInstanceFast:) — Adds an instance without undo registration or change notifications.
- [`GSFont removeInstance:`](/Core/GlyphsCore/GSFont/removeInstance:) — Removes an instance from the font.
- [`GSFont removeInstances:`](/Core/GlyphsCore/GSFont/removeInstances:) — Removes instances from the font.
- [`GSFont removeObjectFromInstancesAtIndex:`](/Core/GlyphsCore/GSFont/removeObjectFromInstancesAtIndex:) — Removes the instance at an index.
- [`GSFont instanceGroups`](/Core/GlyphsCore/GSFont/instanceGroups) — Instance groups for UI presentation.
- [`GSFont instancesUnique`](/Core/GlyphsCore/GSFont/instancesUnique) — Instances with unique interpolation locations.
- [`GSFont instanceAtPosition:`](/Core/GlyphsCore/GSFont/instanceAtPosition:) — Returns the instance at an internal design-space position.
- [`GSFont instanceNearestToPosition:distance:`](/Core/GlyphsCore/GSFont/instanceNearestToPosition:distance:) — Returns the instance nearest to an internal design-space position.

