---
title: bytes
framework: healthkit
role: symbol
role_heading: Instance Property
path: healthkit/hkattachmentdatareader/bytes
---

# bytes

An asynchronous sequence that provides the attachment’s data.

## Declaration

```swift
var bytes: HKAttachment.AsyncBytes { get }
```

## Discussion

Discussion Use this property to access the file’s contents as an asynchronous sequence of bytes. // Asynchronously access the attachment's bytes. var data = Data() do {     for try await byte in dataReader.bytes {         // Use the bytes here.         data.append(byte)     } } catch {     // Handle the error here.     fatalError("*** An error occurred while reading the attachment's data: \(error.localizedDescription) ***") }

## See Also

### Reading attachment data

- [data](healthkit/hkattachmentdatareader/data.md)
- [progress](healthkit/hkattachmentdatareader/progress.md)
