---
title: inviteHandler
framework: gamekit
role: symbol
role_heading: Instance Property
path: gamekit/gkmatchmaker/invitehandler
---

# inviteHandler

A block that GameKit calls when an invitation to join a match is accepted by the local player.

## Declaration

```swift
var inviteHandler: ((GKInvite, [Any]?) -> Void)? { get set }
```

## Discussion

Discussion The block takes the following parameters: Your block needs to respond to the invitation in one of two ways: Display the standard user interface by initializing a new GKMatchmakerViewController object, passing the invitation object and the list of player identifiers as parameters. Create a match programmatically by calling the match(for:completionHandler:) method on the shared matchmaker instance. If your game receives an invitation while it’s running, it needs to transition to multiplayer play. It must clean up any existing content, such as ending the current match the player is playing, and then process the invitation.
