---
title: GKTurnBasedMatchmakerViewController
framework: gamekit
role: symbol
role_heading: Class
path: gamekit/gkturnbasedmatchmakerviewcontroller
---

# GKTurnBasedMatchmakerViewController

An interface that allows a player to invite other players to a turn-based match and automatch to fill any empty slots.

## Declaration

```swift
class GKTurnBasedMatchmakerViewController
```

## Mentioned in

Starting turn-based matches and passing turns between players

## Overview

Overview Before you create a GKTurnBasedMatchmakerViewController object, create a GKMatchRequest object and configure it according to the parameters of your game. Then, pass the match request to the init(matchRequest:) initializer to create the view controller. Configure the view controller and set its delegate before you present it to the local player. The view controller allows the local player to choose other players and optionally fill empty slots using automatch. The interface also allows players to select an existing match, forfeit a match, or view a completed match. Implement the GKTurnBasedMatchmakerViewControllerDelegate protocol to handle when a player selects players, cancels matchmaking, or encounters an error. Implement the turnBasedMatchmakerViewController(_:didFind:) delegate method to dismiss the view controller when the local player invites players. Register as a listener of the GKLocalPlayerListener protocol and implement GKTurnBasedEventListener methods that handle other turn-based events. For example, implement the player(_:receivedTurnEventFor:didBecomeActive:) to update match data and present the gameplay interface for the local player to take their turn. In iOS, you present and dismiss the view controller from another view controller in your game, using the methods provided by the UIViewController class. If you use SwiftUI, you can get the root view controller from the UIApplication object. In macOS, you use the GKDialogController class to present and dismiss the view controller.

## Topics

### Creating and Configuring the View Controller

- [init(matchRequest:)](gamekit/gkturnbasedmatchmakerviewcontroller/init(matchrequest:).md)
- [showExistingMatches](gamekit/gkturnbasedmatchmakerviewcontroller/showexistingmatches.md)
- [matchmakingMode](gamekit/gkturnbasedmatchmakerviewcontroller/matchmakingmode.md)
- [GKMatchmakingMode](gamekit/gkmatchmakingmode.md)

### Setting the Delegate

- [turnBasedMatchmakerDelegate](gamekit/gkturnbasedmatchmakerviewcontroller/turnbasedmatchmakerdelegate.md)
- [GKTurnBasedMatchmakerViewControllerDelegate](gamekit/gkturnbasedmatchmakerviewcontrollerdelegate.md)

## Relationships

### Inherits From

- [NSViewController](appkit/nsviewcontroller.md)
- [UINavigationController](uikit/uinavigationcontroller.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [GKViewController](gamekit/gkviewcontroller.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSEditor](appkit/nseditor.md)
- [NSExtensionRequestHandling](foundation/nsextensionrequesthandling.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSeguePerforming](appkit/nssegueperforming.md)
- [NSStandardKeyBindingResponding](appkit/nsstandardkeybindingresponding.md)
- [NSTouchBarProvider](appkit/nstouchbarprovider.md)
- [NSUserActivityRestoring](appkit/nsuseractivityrestoring.md)
- [NSUserInterfaceItemIdentification](appkit/nsuserinterfaceitemidentification.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [UIActivityItemsConfigurationProviding](uikit/uiactivityitemsconfigurationproviding.md)
- [UIAppearanceContainer](uikit/uiappearancecontainer.md)
- [UIContentContainer](uikit/uicontentcontainer.md)
- [UIFocusEnvironment](uikit/uifocusenvironment.md)
- [UIPasteConfigurationSupporting](uikit/uipasteconfigurationsupporting.md)
- [UIResponderStandardEditActions](uikit/uiresponderstandardeditactions.md)
- [UIStateRestoring](uikit/uistaterestoring.md)
- [UITraitChangeObservable](uikit/uitraitchangeobservable-67e94.md)
- [UITraitEnvironment](uikit/uitraitenvironment.md)
- [UIUserActivityRestoring](uikit/uiuseractivityrestoring.md)

## See Also

### Turn-based games

- [Creating turn-based games](gamekit/creating-turn-based-games.md)
- [Starting turn-based matches and passing turns between players](gamekit/starting-turn-based-matches-and-passing-turns-between-players.md)
- [Sending messages to players in turn-based games](gamekit/sending-messages-to-players-in-turn-based-games.md)
- [Exchanging data between players in turn-based games](gamekit/exchanging-data-between-players-in-turn-based-games.md)
- [GKTurnBasedMatch](gamekit/gkturnbasedmatch.md)
- [GKTurnBasedParticipant](gamekit/gkturnbasedparticipant.md)
- [GKTurnBasedEventListener](gamekit/gkturnbasedeventlistener.md)
- [GKTurnBasedExchange](gamekit/gkturnbasedexchange.md)
- [GKTurnBasedExchangeReply](gamekit/gkturnbasedexchangereply.md)
- [GKGameCenterBadgingDisabled](bundleresources/information-property-list/gkgamecenterbadgingdisabled.md)
