---
title: "replaceSubrange(_:with:)"
framework: coremedia
role: symbol
role_heading: Instance Method
path: "coremedia/cmmutabledatablockbuffer/replacesubrange(_:with:)-5w62q"
---

# replaceSubrange(_:with:)

Replace a range of bytes in the block buffer.

## Declaration

```swift
mutating func replaceSubrange(_ range: Range<Int>, with bytes: some DataProtocol)
```

## Parameters

- `range`: Range of bytes to replace within this buffer. The count of this range must match the count of bytes.
- `bytes`: The replacement data.

## Discussion

Discussion This function also works if the range covers non-contiguous regions of memory.
