<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/AccelerateBuffer/withUnsafeBufferPointer(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate0A6BufferP010withUnsafeB7Pointeryqd__qd__SRy7ElementQzGKXEKlF"
  },
  "title" : "withUnsafeBufferPointer(_:)"
}
-->

# withUnsafeBufferPointer(_:)

Calls a closure with a pointer to the object’s contiguous storage.

```
func withUnsafeBufferPointer<R>(_ body: (UnsafeBufferPointer<Self.Element>) throws -> R) rethrows -> R
```

## Parameters

`body`

A closure that receives an <doc://com.apple.documentation/documentation/Swift/UnsafeBufferPointer> to the sequence’s contiguous storage.

---

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)