<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/LowLevelBuffer/replace(using:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation14LowLevelBufferC7replace5usingSo9MTLBuffer_pSo010MTLCommandE0_p_tF"
  },
  "title" : "replace(using:)"
}
-->

# replace(using:)

Retrieve an MTLBuffer that can be used to replace the contents of the buffer
on GPU using Metal.

```
final func replace(using commandBuffer: any MTLCommandBuffer) -> any MTLBuffer
```

## Discussion

The buffer’s contents are in an uninitialized state.

The caller supplies the MTLCommandBuffer that they intend to use for buffer modifications. RealityKit will
wait for the MTLCommandBuffer to complete before utilizing the buffer for rendering.

---

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)