---
title: waitForDataInBackgroundAndNotify()
framework: foundation
role: symbol
role_heading: Instance Method
path: foundation/filehandle/waitfordatainbackgroundandnotify()
---

# waitForDataInBackgroundAndNotify()

Asynchronously checks to see if data is available.

## Declaration

```swift
func waitForDataInBackgroundAndNotify()
```

## Discussion

Discussion When the data becomes available, this method posts a NSFileHandleDataAvailable notification on the current thread. You must call this method from a thread that has an active run loop.

## See Also

### Reading asynchronously with notifications

- [acceptConnectionInBackgroundAndNotify()](foundation/filehandle/acceptconnectioninbackgroundandnotify().md)
- [acceptConnectionInBackgroundAndNotify(forModes:)](foundation/filehandle/acceptconnectioninbackgroundandnotify(formodes:).md)
- [readInBackgroundAndNotify()](foundation/filehandle/readinbackgroundandnotify().md)
- [readInBackgroundAndNotify(forModes:)](foundation/filehandle/readinbackgroundandnotify(formodes:).md)
- [readToEndOfFileInBackgroundAndNotify()](foundation/filehandle/readtoendoffileinbackgroundandnotify().md)
- [readToEndOfFileInBackgroundAndNotify(forModes:)](foundation/filehandle/readtoendoffileinbackgroundandnotify(formodes:).md)
- [waitForDataInBackgroundAndNotify(forModes:)](foundation/filehandle/waitfordatainbackgroundandnotify(formodes:).md)
