# `GSShapeGroup depth(of:)`

*Instance Method*

Returns the relative depth of the shape within the group.

## Declaration

```swift
func depth(of shape: GSShape) -> Int?
```

## Discussion

`0` if the shape is the receiver and `nil` 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).

