Instance Method


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


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



A block called when the reachability for a player changes. The block takes the following parameters:


The player identifier for the player whose reachability status has changed.


true if a new player has been discovered locally, false if a previously discovered player has disappeared.


You only use this method when you are implementing programmatic matchmaking. After enabling browsing for nearby players, use the responses to populate your user interface with information about nearby players. If a player wants to invite a player to a game, add that player’s player identifier to a match request and call either the findMatch(for:withCompletionHandler:) to create a match or addPlayers(to:matchRequest:completionHandler:) method to update a match.

See Also

Deprecated Methods and Properties

func cancelInvite(toPlayer: String)

Cancels a pending invitation to another player.

var inviteHandler: ((GKInvite, [Any]?) -> Void)?

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


Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software