<!--
{
  "availability" : [
    "macCatalyst: 14.0.0 -",
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "IOUSBHost",
  "identifier" : "/documentation/IOUSBHost/IOUSBHostStream/enqueueIORequest(with:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "IOUSBHost"
    ],
    "preciseIdentifier" : "c:objc(cs)IOUSBHostStream(im)enqueueIORequestWithData:error:completionHandler:"
  },
  "title" : "enqueueIORequest(with:completionHandler:)"
}
-->

# enqueueIORequest(with:completionHandler:)

Enqueues an input/output request on the stream.

```
func enqueueIORequest(with data: NSMutableData?, completionHandler: (@Sendable (IOReturn, Int) -> Void)? = nil) throws
```

## Parameters

`data`

An <doc://com.apple.documentation/documentation/Foundation/NSMutableData> object defining the memory to use for the transfer.

`completionHandler`

An [`IOUSBHostCompletionHandler`](/documentation/IOUSBHost/IOUSBHostCompletionHandler) that runs when the request completes. The `completionHandler` doesn’t run if the method returns an error.

## Return Value

`YES` if the request completes successfully; otherwise, `NO`.

## Discussion

> Important:
> You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration:
> 
> ```swift
> func enqueueIORequest(with data: NSMutableData?) async throws -> (IOReturn, Int)
> ```
> 
> For information about concurrency and asynchronous code in Swift, see <doc://com.apple.documentation/documentation/Swift/calling-objective-c-apis-asynchronously>.

This method sends an asynchronous request on the stream.

> Note:
> Completion timeouts aren’t applicable to streams.

---

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)