---
title: "resetBytes(in:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsmutabledata/resetbytes(in:)"
---

# resetBytes(in:)

Replaces with zeroes the contents of the receiver in a given range.

## Declaration

```swift
func resetBytes(in range: NSRange)
```

## Parameters

- `range`: The range within the contents of the receiver to be replaced by zeros. The range must not exceed the bounds of the receiver.

## Discussion

Discussion If the location of range isn’t within the receiver’s range of bytes, an NSRangeException is raised. The receiver is resized to accommodate the new bytes, if necessary.

## See Also

### Modifying Bytes

- [replaceBytes(in:withBytes:)](foundation/nsmutabledata/replacebytes(in:withbytes:).md)
- [replaceBytes(in:withBytes:length:)](foundation/nsmutabledata/replacebytes(in:withbytes:length:).md)
- [setData(_:)](foundation/nsmutabledata/setdata(_:).md)
