Instance Method

invitePeer(_:to:withContext:timeout:)

Invites a discovered peer to join a Multipeer Connectivity session.

Declaration

func invitePeer(_ peerID: MCPeerID, to session: MCSession, withContext context: Data?, timeout: TimeInterval)

Parameters

peer

The ID of the peer to invite.

session

The session you wish the invited peer to join.

context

An arbitrary piece of data that is passed to the nearby peer. This can be used to provide further information to the user about the nature of the invitation.

timeout

The amount of time to wait for the peer to respond to the invitation.

This timeout is measured in seconds, and must be a positive value. If a negative value or zero is specified, the default timeout (30 seconds) is used.