session(_:peer:didChange:)
Called when the state of a nearby peer changes.
Declaration
func session(_ session: MCSession, peer peerID: MCPeerID, didChange state: MCSessionState)Parameters
- session:
The session that manages the nearby peer whose state changed.
- peerID:
The ID of the nearby peer whose state changed.
- state:
The new state of the nearby peer.
Discussion
This delegate method is called with the following state values when the nearby peer’s state changes:
MCSessionState.connected—the nearby peer accepted the invitation and is now connected to the session.
MCSessionState.notConnected—the nearby peer declined the invitation, the connection could not be established, or a previously connected peer is no longer connected.