# `GSShapeGroup depthOfShape:`

*Instance Method*

Returns the relative depth of the shape within the group.

## Declaration

```objc
- (NSInteger) depthOfShape:(GSShape *) shape;
```

```python
depthOfShape_(shape: GSShape) -> int
```

## Discussion

`0` if the shape is the receiver and `-1` if the group does not contain the shape.

> **Complexity**
> O(*d*) where *d* is the group nesting depth of the shape. O(*n*) when the group or shape has a layer of `nil` where *n* is the number of members of the group.

## See Also

### Membership

- [`GSShapeGroup containsShape:`](/Core/GlyphsCore/GSShapeGroup/containsShape:) — Returns whether the given shape is a member of the group.
- [`GSShapeGroup groupIndexRange`](/Core/GlyphsCore/GSShapeGroup/groupIndexRange) — The range of layer shape indices that includes all group members and the index of the group shape itself (which is always at the last index of the range).

