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

# copyStream(withStreamID:)

Returns the stream for a stream ID.

```
func copyStream(withStreamID streamID: Int) throws -> IOUSBHostStream
```

## Parameters

`streamID`

A stream ID in the range of 1 to *n*. Retrieve *n* can by calling [`IOUSBGetEndpointMaxStreams(_:_:_:)`](/documentation/IOUSBHost/IOUSBGetEndpointMaxStreams(_:_:_:)) with the <doc://com.apple.documentation/documentation/iokit/iousbendpointdescriptor>.

## Return Value

A pointer to an [`IOUSBHostStream`](/documentation/IOUSBHost/IOUSBHostStream); otherwise, `nil` if the device or the underlying host controller doesn’t support the specified stream ID.

## Discussion

Call [`enableStreams()`](/documentation/IOUSBHost/IOUSBHostPipe/enableStreams()) before this method.

---

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)