<!--
{
  "availability" : [
    "iOS: 4.1.0 -",
    "iPadOS: 4.1.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.8.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GameKit",
  "identifier" : "/documentation/GameKit/GKMatchmakerViewController",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "GameKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKMatchmakerViewController"
  },
  "title" : "GKMatchmakerViewController"
}
-->

# GKMatchmakerViewController

An interface that allows a player to invite other players to a real-time game and automatch to fill any empty slots.

```
class GKMatchmakerViewController
```

## Overview

Before you create a `GKMatchmakerViewController` object, create a [`GKMatchRequest`](/documentation/GameKit/GKMatchRequest) object and configure it according to the parameters of your game. Then pass the match request to the [`init(matchRequest:)`](/documentation/GameKit/GKMatchmakerViewController/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. If you add the Group Activities capability to your Xcode project, the player can invite others using SharePlay. See <doc://com.apple.documentation/documentation/Xcode/configuring-group-activities>.

Implement the [`GKLocalPlayerListener`](/documentation/GameKit/GKLocalPlayerListener) and [`GKMatchmakerViewControllerDelegate`](/documentation/GameKit/GKMatchmakerViewControllerDelegate) protocols to handle when players send and accept invitations. Implement the [`player(_:didAccept:)`](/documentation/GameKit/GKInviteEventListener/player(_:didAccept:)) delegate method to present a `GKMatchmakerViewController` object, which you create using the [`init(invite:)`](/documentation/GameKit/GKMatchmakerViewController/init(invite:)) initializer, to the player who accepts an invitation. Then, implement the [`matchmakerViewController(_:didFind:)`](/documentation/GameKit/GKMatchmakerViewControllerDelegate/matchmakerViewController(_:didFind:)) delegate method to dismiss the view controller and start the game when all players accept their invitations.

In iOS, you present and dismiss the view controller from another view controller in your game, using the methods from the <doc://com.apple.documentation/documentation/UIKit/UIViewController> class. If you use SwiftUI, you can get the root view controller from the <doc://com.apple.documentation/documentation/UIKit/UIApplication> object.

```swift
let rootViewController = UIApplication.shared.windows.first!.rootViewController
```

For visionOS games, the view controller appears anchored to the window, scene, or view relative to where you present the view controller. For immersive games, set the parent window to a separate window group than the immersive space window group.

For macOS games, use the [`GKDialogController`](/documentation/GameKit/GKDialogController) class to present and dismiss the view controller.

For the complete matchmaking flow with code fragments, see [Finding multiple players for a game](/documentation/GameKit/finding-multiple-players-for-a-game).

## Topics

### Creating and configuring the view controller

[`init(matchRequest:)`](/documentation/GameKit/GKMatchmakerViewController/init(matchRequest:))

Creates a matchmaker view controller for the local player to start inviting other players.

[`init(invite:)`](/documentation/GameKit/GKMatchmakerViewController/init(invite:))

Creates a matchmaker view controller to present to a player who accepts an invitation.

[`matchRequest`](/documentation/GameKit/GKMatchmakerViewController/matchRequest)

The configuration for the desired match.

[`canStartWithMinimumPlayers`](/documentation/GameKit/GKMatchmakerViewController/canStartWithMinimumPlayers)

A Boolean value that indicates whether your game can start after a minimum number of players join a match.

[`matchmakingMode`](/documentation/GameKit/GKMatchmakerViewController/matchmakingMode)

The mode that a multiplayer game uses to find players.

[`GKMatchmakingMode`](/documentation/GameKit/GKMatchmakingMode)

Possible modes that a multiplayer game uses to find matches.

### Setting the delegate

[`matchmakerDelegate`](/documentation/GameKit/GKMatchmakerViewController/matchmakerDelegate)

The object that handles matchmaker view controller changes.

[`GKMatchmakerViewControllerDelegate`](/documentation/GameKit/GKMatchmakerViewControllerDelegate)

An object that handles when the status of matchmaking changes.

### Adding players to matches

[`addPlayers(to:)`](/documentation/GameKit/GKMatchmakerViewController/addPlayers(to:))

Invites additional players to join an existing match.

### Hosting matches

[`isHosted`](/documentation/GameKit/GKMatchmakerViewController/isHosted)

A Boolean value that indicates whether the match is hosted or peer-to-peer.

[`setHostedPlayer(_:didConnect:)`](/documentation/GameKit/GKMatchmakerViewController/setHostedPlayer(_:didConnect:))

Updates the connection status of a player in a hosted game.

### Deprecated

[`setHostedPlayer(_:connected:)`](/documentation/GameKit/GKMatchmakerViewController/setHostedPlayer(_:connected:))

Updates a player’s status on the view to show that the player has connected or disconnected from your server.

[`setHostedPlayerReady(_:)`](/documentation/GameKit/GKMatchmakerViewController/setHostedPlayerReady(_:))

Informs the controller that a player has joined a hosted match.

[`defaultInvitationMessage`](/documentation/GameKit/GKMatchmakerViewController/defaultInvitationMessage)

The default invitation message sent to a player.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)