Contents

startStream(withName:toPeer:)

Opens a byte stream to a nearby peer.

Declaration

func startStream(withName streamName: String, toPeer peerID: MCPeerID) throws -> OutputStream

Parameters

  • streamName:

    A name for the stream. This name is provided to the nearby peer.

  • peerID:

    The ID of the nearby peer.

Return Value

In Swift, an output stream instance. In Objective-C, an output stream object upon success or nil if a stream could not be established.

Discussion

This method is nonblocking.

For more information about performing networking with input and output streams, read Networking Programming Topics.

See Also

Sending Data and Resources