---
title: "withUnsafeBytes(body:)"
framework: dispatch
role: symbol
role_heading: Instance Method
path: "dispatch/dispatchdata/withunsafebytes(body:)"
---

# withUnsafeBytes(body:)

## Declaration

```swift
func withUnsafeBytes<Result, ContentType>(body: (UnsafePointer<ContentType>) throws -> Result) rethrows -> Result
```

## See Also

### Creating a Dispatch Data Structure

- [init(bytes:)](dispatch/dispatchdata/init(bytes:)-9lrd.md)
- [init(bytesNoCopy:deallocator:)](dispatch/dispatchdata/init(bytesnocopy:deallocator:)-vfoe.md)
- [DispatchData.Deallocator](dispatch/dispatchdata/deallocator.md)
- [empty](dispatch/dispatchdata/empty.md)
