<!--
{
  "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/DataAvailableMessage",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:So12NSFileHandleC10FoundationE20DataAvailableMessageV"
  },
  "title" : "FileHandle.DataAvailableMessage"
}
-->

# FileHandle.DataAvailableMessage

A message a file handle sends when it determines data is available for reading from a file or communications channel.

```
struct DataAvailableMessage
```

## Overview

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

Observe this message with the identifier [`dataAvailable`](/documentation/Foundation/NotificationCenter/MessageIdentifier/dataAvailable), 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 [`NSFileHandleDataAvailable`](/documentation/Foundation/NSNotification/Name-swift.struct/NSFileHandleDataAvailable).
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()`](/documentation/Foundation/FileHandle/DataAvailableMessage/init())

Creates a message that indicates a file handle has data available for reading.

## Relationships

### Conforms To

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

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

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

---

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)