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

# ConvertibleToBytes

A protocol for types whose memory can safely be read as individual raw bytes.

```
protocol ConvertibleToBytes
```

## Overview

A type can conform to ConvertibleToBytes if its memory representation
includes no padding. The sum of the size of its stored properties must be
equal to its stride.

A type that conforms to ConvertibleToBytes must have:

- one or more stored properties,
- all of its stored properties have a type which conforms to
  `ConvertibleToBytes`,
- its stored properties are stored contiguously in memory, with no padding,
- none of its values disregards a subset of its bytes, making most enums
  ineligible.

## Relationships

### Conforming Types

[`Int`](/documentation/Swift/Int)

[`Duration`](/documentation/Swift/Duration)

[`SIMD4`](/documentation/Swift/SIMD4)

[`Iterator`](/documentation/Swift/PartialRangeFrom/Iterator)

[`UInt64`](/documentation/Swift/UInt64)

[`Range`](/documentation/Swift/Range)

[`ClosedRange`](/documentation/Swift/ClosedRange)

[`UInt8`](/documentation/Swift/UInt8)

[`SIMD32`](/documentation/Swift/SIMD32)

[`PartialRangeFrom`](/documentation/Swift/PartialRangeFrom)

[`Int16`](/documentation/Swift/Int16)

[`Float`](/documentation/Swift/Float)

[`UInt128`](/documentation/Swift/UInt128)

[`UInt`](/documentation/Swift/UInt)

[`Int8`](/documentation/Swift/Int8)

[`Bool`](/documentation/Swift/Bool)

[`UInt32`](/documentation/Swift/UInt32)

[`Float16`](/documentation/Swift/Float16)

[`SIMD64`](/documentation/Swift/SIMD64)

[`CollectionOfOne`](/documentation/Swift/CollectionOfOne)

[`Int32`](/documentation/Swift/Int32)

[`UnsafeMutablePointer`](/documentation/Swift/UnsafeMutablePointer)

[`ObjectIdentifier`](/documentation/Swift/ObjectIdentifier)

[`UnsafeBufferPointer`](/documentation/Swift/UnsafeBufferPointer)

[`UnsafeMutableRawBufferPointer`](/documentation/Swift/UnsafeMutableRawBufferPointer)

[`SIMD16`](/documentation/Swift/SIMD16)

[`UInt16`](/documentation/Swift/UInt16)

[`InlineArray`](/documentation/Swift/InlineArray)

[`PartialRangeThrough`](/documentation/Swift/PartialRangeThrough)

[`Int128`](/documentation/Swift/Int128)

[`OpaquePointer`](/documentation/Swift/OpaquePointer)

[`SIMD2`](/documentation/Swift/SIMD2)

[`UnsafeMutableRawPointer`](/documentation/Swift/UnsafeMutableRawPointer)

[`UnsafeRawBufferPointer`](/documentation/Swift/UnsafeRawBufferPointer)

[`SIMD8`](/documentation/Swift/SIMD8)

[`Double`](/documentation/Swift/Double)

[`UnsafeRawPointer`](/documentation/Swift/UnsafeRawPointer)

[`UnsafeMutableBufferPointer`](/documentation/Swift/UnsafeMutableBufferPointer)

[`UnsafePointer`](/documentation/Swift/UnsafePointer)

[`PartialRangeUpTo`](/documentation/Swift/PartialRangeUpTo)

[`Int64`](/documentation/Swift/Int64)

---

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)