<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMedia",
  "identifier" : "/documentation/CoreMedia/CMBlockBuffer/withUnsafeMutableBytes(atOffset:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Media",
      "CoreMedia"
    ],
    "preciseIdentifier" : "s:So16CMBlockBufferRefa9CoreMediaE22withUnsafeMutableBytes8atOffset_xSi_xSwKXEtKlF"
  },
  "title" : "withUnsafeMutableBytes(atOffset:_:)"
}
-->

# withUnsafeMutableBytes(atOffset:_:)

Accesses the data that a block buffer represents.

```
func withUnsafeMutableBytes<R>(atOffset offset: Int = 0, _ body: (UnsafeMutableRawBufferPointer) throws -> R) throws -> R
```

## Parameters

`offset`

An offset within the buffer’s offset range.

`body`

A closure the system calls with an <doc://com.apple.documentation/documentation/Swift/UnsafeMutableRawBufferPointer> parameter that points to contiguous storage in the block buffer.

## Return Value

The value, if any, that the body parameter returns

---

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)