A user interface that allows players to manage the turn-based matches that they are participating in.


iOS, Mac Catalyst, tvOS
@interface GKTurnBasedMatchmakerViewController : UINavigationController
@interface GKTurnBasedMatchmakerViewController : NSViewController


To show a turn-based matching user interface, first allocate and initialize a GKMatchRequest object that describes the desired match. Then, use the match request to initialize a new GKTurnBasedMatchmakerViewController object. Set the view controller’s delegate, present the view controller, and wait for the delegate to be called. The view controller’s delegate is notified when the matchmaking process is completed or canceled. Once the delegate is called, dismiss the view controller.

In iOS, you present and dismiss the view controller from another view controller in your game, using the methods provided by the UIViewController class. In macOS, you use the GKDialogController class to present and dismiss the view controller. Listing 1 shows a typical implementation.

Listing 1

Displaying the standard interface to join a turn-based match

- (IBAction)joinChessMatch: (id) sender
    GKMatchRequest *request = [[GKMatchRequest alloc] init];
    request.minPlayers = 2;
    request.maxPlayers = 2;
    GKTurnBasedMatchmakerViewController *mmvc = [[GKTurnBasedMatchmakerViewController alloc] initWithMatchRequest:request];
    mmvc.turnBasedMatchmakerDelegate = self;
    [self presentViewController:mmvc animated:YES completion:nil];


Displaying a UI For Turn-Based Matches

- initWithMatchRequest:

Initializes a new matchmaker view controller.


A Boolean value that determines whether the view controller shows existing matches.


The view controller’s delegate.


Your game implements the GKTurnBasedMatchmakerViewControllerDelegate protocol on an object to respond to events generated by a GKTurnBasedMatchmakerViewController object.


Conforms To

See Also

Player Invitations


An object that programmatically creates matches with other players and receives match invitations sent by other players.


A user interface for inviting friends to a match or for allowing Game Center to fill the remaining players needed for a match.


A matchmaking invitation sent by another player to the local player.