<!--
{
  "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/ConstraintsCollection/set(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation5IKRigV21ConstraintsCollectionV3setyAC10ConstraintVSgAHF"
  },
  "title" : "set(_:)"
}
-->

# set(_:)

Updates the element with identifier matching the provided value’s identifier.

```
@discardableResult mutating func set(_ newValue: IKRig.ConstraintsCollection.Element) -> IKRig.ConstraintsCollection.Element?
```

## Parameters

`newValue`

The new element value to store.

## Return Value

The previous element value if the identifier exists, `nil` otherwise.

## Discussion

If an element with the provided identifier is not contained, adds a new one.

---

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)