<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 8.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/ContiguousBytes",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation15ContiguousBytesP"
  },
  "title" : "ContiguousBytes"
}
-->

# ContiguousBytes

A protocol that declares the type offers direct access to the underlying raw bytes in a contiguous manner.

```
protocol ContiguousBytes : ~Copyable, ~Escapable
```

## Topics

### Accessing Underlying Storage

[`withUnsafeBytes(_:)`](/documentation/Foundation/ContiguousBytes/withUnsafeBytes(_:))

Calls the given closure with a pointer to the underlying bytes of the type’s contiguous storage.

## Relationships

### Conforming Types

[`Data`](/documentation/Foundation/Data)

---

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)