---
title: GKMatchmaker
framework: gamekit
role: symbol
role_heading: Class
path: gamekit/gkmatchmaker
---

# GKMatchmaker

An object that creates matches with other players without presenting an interface to the players.

## Declaration

```swift
class GKMatchmaker
```

## Mentioned in

Creating activities for your game Finding multiple players for a game Finding players with similar skill levels

## Overview

Overview Use the GKMatchmaker class to auto-match players for a quicker game start, programmatically invite specific players, or implement your own interface for players to invite other players. If you want to present a familiar matchmaking GameKit interface to players, instead use either the GKMatchmakerViewController or GKTurnBasedMatchmakerViewController class. If you host a game on your own server, you can also use this class to find Game Center players. That is, you implement the networking and communication between the players through your own servers not Game Center. To find players using this class, create a GKMatchRequest object and configure it according to the parameters of your game. Then, pass the match request and a handler using the findMatch(for:withCompletionHandler:) method, or the findPlayers(forHostedMatchRequest:withCompletionHandler:) method for hosted games, to the shared GKMatchmaker object. GameKit calls the handler when players accept their invitations. Implement the handler to set the delegate of the GKMatch object that GameKit sends and start the game when there are enough players. If the match doesn’t have enough players (for example, some players decline their invitations), you can create another match request and call the addPlayers(to:matchRequest:completionHandler:) method repeatedly until the match’s expectedPlayerCount property is zero. When you have enough players to start the match, call the finishMatchmaking(for:) method to end the matchmaking process. If you provide a SharePlay interface for inviting players, use the startGroupActivity(playerHandler:) and stopGroupActivity() methods to create a group activity on behalf of the player.

## Topics

### Retrieving the shared matchmaker

- [shared()](gamekit/gkmatchmaker/shared().md)

### Receiving invitations from other players

- [match(for:completionHandler:)](gamekit/gkmatchmaker/match(for:completionhandler:).md)

### Matching players

- [findMatch(for:withCompletionHandler:)](gamekit/gkmatchmaker/findmatch(for:withcompletionhandler:).md)
- [findPlayers(forHostedRequest:withCompletionHandler:)](gamekit/gkmatchmaker/findplayers(forhostedrequest:withcompletionhandler:).md)
- [findMatchedPlayers(_:withCompletionHandler:)](gamekit/gkmatchmaker/findmatchedplayers(_:withcompletionhandler:).md)
- [GKMatchedPlayers](gamekit/gkmatchedplayers.md)
- [addPlayers(to:matchRequest:completionHandler:)](gamekit/gkmatchmaker/addplayers(to:matchrequest:completionhandler:).md)
- [finishMatchmaking(for:)](gamekit/gkmatchmaker/finishmatchmaking(for:).md)
- [cancel()](gamekit/gkmatchmaker/cancel().md)
- [cancelPendingInvite(to:)](gamekit/gkmatchmaker/cancelpendinginvite(to:).md)

### Finding players who request matches

- [queryActivity(completionHandler:)](gamekit/gkmatchmaker/queryactivity(completionhandler:).md)
- [queryPlayerGroupActivity(_:withCompletionHandler:)](gamekit/gkmatchmaker/queryplayergroupactivity(_:withcompletionhandler:).md)
- [queryQueueActivity(_:withCompletionHandler:)](gamekit/gkmatchmaker/queryqueueactivity(_:withcompletionhandler:).md)

### Looking for nearby players

- [startBrowsingForNearbyPlayers(handler:)](gamekit/gkmatchmaker/startbrowsingfornearbyplayers(handler:).md)
- [stopBrowsingForNearbyPlayers()](gamekit/gkmatchmaker/stopbrowsingfornearbyplayers().md)

### Starting matches using SharePlay

- [startGroupActivity(playerHandler:)](gamekit/gkmatchmaker/startgroupactivity(playerhandler:).md)
- [stopGroupActivity()](gamekit/gkmatchmaker/stopgroupactivity().md)

### Deprecated

- [Deprecated Symbols](gamekit/gkmatchmaker-deprecated-symbols.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Real-time games

- [Creating real-time games](gamekit/creating-real-time-games.md)
- [Finding multiple players for a game](gamekit/finding-multiple-players-for-a-game.md)
- [Exchanging data between players in real-time games](gamekit/exchanging-data-between-players-in-real-time-games.md)
- [Adding voice chat to multiplayer games](gamekit/adding-voice-chat-to-multiplayer-games.md)
- [Finding players for custom server-based games](gamekit/finding-players-for-custom-server-based-games.md)
- [Matchmaking rules](gamekit/matchmaking-rules.md)
- [GKMatchRequest](gamekit/gkmatchrequest.md)
- [GKMatchmakerViewController](gamekit/gkmatchmakerviewcontroller.md)
- [GKInviteEventListener](gamekit/gkinviteeventlistener.md)
- [GKInvite](gamekit/gkinvite.md)
- [GKMatch](gamekit/gkmatch.md)
