Class

Enables your game to stream data & send events and resources over the local network.


Initialization

init ( serves: MCPeerID )

Initializes a broadcaster object which broadcasts on behalf of the passed parameter.

func assistedBy ( _: GPGameEventListener ) → Self

Enables self to receive replies regarding its broadcast.

Sending Things Over the Network

func broadcast ( _: Data, to: [MCPeerID] ) throws

Sends a Data object over the network, destined to the specified receiving peers. The receiving party does not get to give their consent for the resoure to be transmitted.

func stream ( _: InputStream, context: String, to: MCPeerID ) throws → OutputStream

Informs the receiving peer, that self would like to stream bytes over the network, and they should prepare to receive the information. Stream deliveries are controlled under consent the receiving peer.

func send ( resourceAt: URL, to: MCPeerID, context: String, eventHandler: (((any Error)?) -> Void)? ) throws → Progress?

Sends a resource located at the given URL to the receiving peer. The receiving party does not get to give their consent for the resoure to be transmitted.