---
title: "endTurn(withNextParticipant:match:completionHandler:)"
framework: gamekit
role: symbol
role_heading: Instance Method
path: "gamekit/gkturnbasedmatch/endturn(withnextparticipant:match:completionhandler:)"
---

# endTurn(withNextParticipant:match:completionHandler:)

Updates the data stored on Game Center for the current match.

## Declaration

```swift
func endTurn(withNextParticipant nextParticipant: GKTurnBasedParticipant, match matchData: Data, completionHandler: (@Sendable ((any Error)?) -> Void)? = nil)
```

```swift
func endTurn(withNextParticipant nextParticipant: GKTurnBasedParticipant, match matchData: Data) async throws
```

## Parameters

- `nextParticipant`: The next player in the match who needs to take an action. It must be one of the object’s stored in the match’s doc://com.apple.gamekit/documentation/GameKit/GKTurnBasedMatch/participants property.
- `matchData`: A serialized blob of data reflecting the game-specific state for the match. Do not pass nil as an argument.
- `completionHandler`: A block to be called after the data is uploaded to Game Center. The block receives the following parameters:

## Discussion

Discussion When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls your completion handler. The completion handler is always called on the main thread.

## See Also

### Deprecated Methods

- [participantQuitInTurn(with:nextParticipant:match:completionHandler:)](gamekit/gkturnbasedmatch/participantquitinturn(with:nextparticipant:match:completionhandler:).md)
- [endMatchInTurn(withMatch:scores:achievements:completionHandler:)](gamekit/gkturnbasedmatch/endmatchinturn(withmatch:scores:achievements:completionhandler:).md)
