Instance Property


A block to be called when an invitation to join a match is accepted by the local player.


var inviteHandler: ((GKInvite, [Any]?) -> Void)? { get set }


The block takes the following parameters:


The invitation accepted by the player.


An array of NSString objects containing player identifiers for additional players to invite into the game.

Your block should respond to the invitation in one of two ways:

  • Display the standard user interface by initializing a new GKMatchmakerViewController object, passing the invitation object and the list of player identifiers as parameters.

  • Create a match programmatically by calling the match(for:completionHandler:) method on the shared matchmaker instance.

If your game receives an invitation while it is already running, it should transition to multiplayer play. It should clean up any existing content, such as ending the current match the player is playing, and then process the invitation.

See Also

Deprecated Methods and Properties

func cancelInvite(toPlayer: String)

Cancels a pending invitation to another player.

func startBrowsingForNearbyPlayers(reachableHandler: ((String, Bool) -> Void)?)

Enables the matchmaking process to find nearby players through Bluetooth or WiFi (same subnet only).