---
title: "forEach(descendantOf:inclusive:update:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/ikrig/jointcollection/foreach(descendantof:inclusive:update:)"
---

# forEach(descendantOf:inclusive:update:)

Calls the provided closure on each element in the hierarchy rooted at the named joint.

## Declaration

```swift
mutating func forEach(descendantOf rootJointName: String, inclusive: Bool = false, update: (inout IKRig.JointCollection.Element) -> Void)
```

## Parameters

- `rootJointName`: The name of the root of the hierarchy.
- `inclusive`: Flag to include the root joint in the update list.
- `update`: Closure to update the joints in-place.

## Discussion

Discussion note: If the root joint is not found, the closure is not executed.
