# `GSLayer moveShapes:copyBuffer:intoGroup:childIndex:`

*Instance Method*

Moves or copies the given shapes to a new location in the layer’s shape group tree.

## Declaration

```swift
func moveShapes(_ shapes: [GSShape], copyBuffer: NSMutableArray?, into parentGroup: GSShapeGroup?, childIndex: UInt) -> Bool
```

```objc
- (BOOL) moveShapes:(NSArray<GSShape *> *) shapes copyBuffer:(NSMutableArray<GSShape *> *) copyBuffer intoGroup:(GSShapeGroup *) parentGroup childIndex:(NSUInteger) childIndex;
```

```python
moveShapes_copyBuffer_intoGroup_childIndex_(shapes: list[GSShape], copyBuffer: list[GSShape], parentGroup: GSShapeGroup, childIndex: int) -> bool
```

## Parameters

- `shapes` — The shapes to move or copy.
- `copyBuffer` — A buffer for the copied shapes. If `nil`, the shapes are moved. If not `nil`, the shapes are copied and the buffer is populated with the copied shapes, sharing the same indices as the source `shapes`.
- `parentGroup` — The new parent group for the given shapes. If `nil`, the shapes are moved to the root of the layer’s shape group tree.
- `childIndex` — The insertion index for the given shapes in the new parent group. Note that this index must be valid after the given shapes have temporarily been removed from the layer’s shape group tree.

## See Also

### Moving Shapes in Groups

- [`GSLayer handleShapesFromShapes:`](/Core/GlyphsCore/GSLayer/handleShapesFromShapes:) — Returns `subjects` reordered such that the relative order is the same as in `shapes`, excluding any shapes in `subjects` that are members of a shape group in `subjects`.
- [`GSLayer createShapeGroupFromShapes:`](/Core/GlyphsCore/GSLayer/createShapeGroupFromShapes:) — Combines the given shapes into a new shape group.
- [`GSLayer dissolveShapeGroup:`](/Core/GlyphsCore/GSLayer/dissolveShapeGroup:) — Dissolves the given shape group by replacing it with its direct members.

