<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/FileHandle/ReadCompletionMessage",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:So12NSFileHandleC10FoundationE21ReadCompletionMessageV"
  },
  "title" : "FileHandle.ReadCompletionMessage"
}
-->

# FileHandle.ReadCompletionMessage

A message a file handle sends when it reads the data currently available in a file or a communication channel.

```
struct ReadCompletionMessage
```

## Overview

Before adding an observer for this message type, call either [`readInBackgroundAndNotify()`](/documentation/Foundation/FileHandle/readInBackgroundAndNotify()) or [`readInBackgroundAndNotify(forModes:)`](/documentation/Foundation/FileHandle/readInBackgroundAndNotify(forModes:)) on an appropriate [`FileHandle`](/documentation/Foundation/FileHandle) object.

Observe this message with the identifier [`readCompletion`](/documentation/Foundation/NotificationCenter/MessageIdentifier/readCompletion), or specify its type directly to the `addObserver(of:for:using:)` method.
The [`Subject`](/documentation/Foundation/NotificationCenter/MainActorMessage/Subject) of this message type is [`FileHandle`](/documentation/Foundation/FileHandle).

This message interoperates with the notification [`readCompletionNotification`](/documentation/Foundation/FileHandle/readCompletionNotification).
The system notifies observers of the message when the [`NotificationCenter`](/documentation/Foundation/NotificationCenter) posts the notification.
Similarly, the system notifies observers of the notification when it posts the message.

## Topics

### Creating a message

[`init(dataItem: Result<Data, POSIXError>)`](/documentation/Foundation/FileHandle/ReadCompletionMessage/init(dataItem:))

Creates a message that indicates a file handle read data.

### Working with message properties

[`var dataItem: Result<Data, POSIXError>`](/documentation/Foundation/FileHandle/ReadCompletionMessage/dataItem)

A result instance containing either the data read from the file or connection, or else an error.

## Relationships

### Conforms To

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

[`AsyncMessage`](/documentation/Foundation/NotificationCenter/AsyncMessage)

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

---

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)