<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/IKRig/JointCollection/forEach(descendantOf:inclusive:update:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation5IKRigV15JointCollectionV7forEach12descendantOf9inclusive6updateySS_SbyAC0D0VzXEtF"
  },
  "title" : "forEach(descendantOf:inclusive:update:)"
}
-->

# forEach(descendantOf:inclusive:update:)

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

```
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> Note: If the root joint is not found, the closure is not executed.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)