An object implements the GKSessionDelegate protocol to control the behavior of a GKSession object. The delegate is called when other visible peers change their state relative to the session. It is also called to determine whether another peer is allowed to connect to the session.


protocol GKSessionDelegate


Observing Changes to Peers

func session(GKSession, peer: String, didChange: GKPeerConnectionState)

Received by the delegate when a peer changes state.

Connection Requests from Other Peers

func session(GKSession, didReceiveConnectionRequestFromPeer: String)

Received by the delegate when a remote peer wants to create a connection to the session.

Connection Errors

func session(GKSession, connectionWithPeerFailed: String, withError: Error)

Received by the delegate when an attempt to connect to another peer failed.

func session(GKSession, didFailWithError: Error)

Sent to the delegate when a serious error has occurred in the session.


Inherits From

See Also


class GKSession

A GKSession object provides the ability to discover and connect to nearby iOS devices using Bluetooth or Wi-fi.