---
title: "replaceUnsafeMutableIndices(_:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/lowlevelmesh/replaceunsafemutableindices(_:)"
---

# replaceUnsafeMutableIndices(_:)

Replaces the index buffer synchronously on the CPU.

## Declaration

```swift
@MainActor func replaceUnsafeMutableIndices(_ callback: (UnsafeMutableRawBufferPointer) -> Void)
```

## Discussion

Discussion The buffer’s contents are unspecified, and it is the caller’s responsibility to populate the buffer with valid data. The buffer is only valid for the lifetime of the callback.

## See Also

### Accessing mesh data on the CPU with Swift

- [withUnsafeBytes(bufferIndex:_:)](realitykit/lowlevelmesh/withunsafebytes(bufferindex:_:).md)
- [withUnsafeMutableBytes(bufferIndex:_:)](realitykit/lowlevelmesh/withunsafemutablebytes(bufferindex:_:).md)
- [withUnsafeIndices(_:)](realitykit/lowlevelmesh/withunsafeindices(_:).md)
- [withUnsafeMutableIndices(_:)](realitykit/lowlevelmesh/withunsafemutableindices(_:).md)
- [replaceUnsafeMutableBytes(bufferIndex:_:)](realitykit/lowlevelmesh/replaceunsafemutablebytes(bufferindex:_:).md)
