---
title: "copyStream(withStreamID:)"
framework: iousbhost
role: symbol
role_heading: Instance Method
path: "iousbhost/iousbhostpipe/copystream(withstreamid:)"
---

# copyStream(withStreamID:)

Returns the stream for a stream ID.

## Declaration

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

## Parameters

- `streamID`: A stream ID in the range of 1 to n. Retrieve n can by calling doc://com.apple.iousbhost/documentation/IOUSBHost/IOUSBGetEndpointMaxStreams(_:_:_:) with the doc://com.apple.documentation/documentation/iokit/iousbendpointdescriptor.

## Return Value

Return Value A pointer to an IOUSBHostStream; otherwise, nil if the device or the underlying host controller doesn’t support the specified stream ID.

## Discussion

Discussion Call enableStreams() before this method.

## See Also

### Managing Streams

- [enableStreams()](iousbhost/iousbhostpipe/enablestreams().md)
- [disableStreams()](iousbhost/iousbhostpipe/disablestreams().md)
