---
title: "replace(using:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/lowlevelbuffer/replace(using:)"
---

# replace(using:)

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

## Declaration

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

## Discussion

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.
