<!--
{
  "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/MutableDataProtocol",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation19MutableDataProtocolP"
  },
  "title" : "MutableDataProtocol"
}
-->

# MutableDataProtocol

A protocol that provides consistent data access to the bytes underlying contiguous and noncontiguous mutable data buffers.

```
protocol MutableDataProtocol : DataProtocol, MutableCollection, RangeReplaceableCollection
```

## Topics

### Resetting Backing Storage

[`func resetBytes<R>(in: R)`](/documentation/Foundation/MutableDataProtocol/resetBytes(in:))

Replaces the contents of the data buffer with zeros for the provided range.

## Relationships

### Inherits From

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

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

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

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

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

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

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

### 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)