<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMedia",
  "identifier" : "/documentation/CoreMedia/CMReadOnlyDataBlockBuffer/BlockRegion",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Core Media",
      "CoreMedia"
    ],
    "preciseIdentifier" : "s:9CoreMedia25CMReadOnlyDataBlockBufferV0F6RegionV"
  },
  "title" : "CMReadOnlyDataBlockBuffer.BlockRegion"
}
-->

# CMReadOnlyDataBlockBuffer.BlockRegion

A contiguous region of memory within a block buffer.

```
struct BlockRegion
```

## Topics

### Instance Properties

[`var count: Int`](/documentation/CoreMedia/CMReadOnlyDataBlockBuffer/BlockRegion/count)

Number of bytes in the block region

[`var endIndex: Int`](/documentation/CoreMedia/CMReadOnlyDataBlockBuffer/BlockRegion/endIndex)

The position one greater than the last valid subscript argument.

[`var regions: CollectionOfOne<CMReadOnlyDataBlockBuffer.BlockRegion>`](/documentation/CoreMedia/CMReadOnlyDataBlockBuffer/BlockRegion/regions)

The single buffer that makes up this region.

[`let startIndex: Int`](/documentation/CoreMedia/CMReadOnlyDataBlockBuffer/BlockRegion/startIndex)

The position of the first element in a nonempty collection.

### Instance Methods

[`func withContiguousStorageIfAvailable<R>((UnsafeBufferPointer<UInt8>) throws -> R) rethrows -> R?`](/documentation/CoreMedia/CMReadOnlyDataBlockBuffer/BlockRegion/withContiguousStorageIfAvailable(_:))

Access contents of the buffer if available as contiguous memory block.

[`func withUnsafeBytes<ResultType>((UnsafeRawBufferPointer) throws -> ResultType) rethrows -> ResultType`](/documentation/CoreMedia/CMReadOnlyDataBlockBuffer/BlockRegion/withUnsafeBytes(_:))

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

### Subscripts

[`subscript(CMReadOnlyDataBlockBuffer.BlockRegion.Index) -> UInt8`](/documentation/CoreMedia/CMReadOnlyDataBlockBuffer/BlockRegion/subscript(_:))

Accesses the data byte at the specified position.

## Relationships

### Conforms To

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

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

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

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

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

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

---

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)