---
title: "notifyOfDataReady(for:completionHandler:)"
framework: avfoundation
role: symbol
role_heading: Type Method
path: "avfoundation/avsamplebuffergenerator/notifyofdataready(for:completionhandler:)"
---

# notifyOfDataReady(for:completionHandler:)

Notifies the sample buffer generator when data is ready for the sample buffer reference or an error has occurred.

## Declaration

```swift
class func notifyOfDataReady(for sbuf: CMSampleBuffer, completionHandler: @escaping @Sendable (Bool, (any Error)?) -> Void)
```

```swift
class func notifyOfDataReady(for sbuf: CMSampleBuffer) async throws
```

## Parameters

- `sbuf`: The CMSampleBufferRef.
- `completionHandler`: A completion block that is called when data is ready for the sample buffer or an error occurs. The dataReady argument is doc://com.apple.documentation/documentation/Swift/true if data is read for the sample buffer. If an error occurs, the error argument contains the NSError object.
