---
title: "saveMergedMatch(_:withResolvedExchanges:completionHandler:)"
framework: gamekit
role: symbol
role_heading: Instance Method
path: "gamekit/gkturnbasedmatch/savemergedmatch(_:withresolvedexchanges:completionhandler:)"
---

# saveMergedMatch(_:withResolvedExchanges:completionHandler:)

Saves match data for completed exchanges without ending the turn.

## Declaration

```swift
func saveMergedMatch(_ matchData: Data, withResolvedExchanges exchanges: [GKTurnBasedExchange], completionHandler: (@Sendable ((any Error)?) -> Void)? = nil)
```

```swift
func saveMergedMatch(_ matchData: Data, withResolvedExchanges exchanges: [GKTurnBasedExchange]) async throws
```

## Parameters

- `matchData`: Your game-specific data representing the match state including the resolved exchange data.
- `exchanges`: The completed exchanges that you resolve or merge into the match data.
- `completionHandler`: The block that GameKit calls when it completes the request. The block receives the following parameter:

## Mentioned in

Exchanging data between players in turn-based games

## Discussion

Discussion Use this method to save the exchange data in the match’s completedExchanges property before the current participant ends their turn, forfeits a match, or ends a match. Alternatively, invoke this method from the player(_:receivedExchangeReplies:forCompletedExchange:for:) protocol method as recipients reply to individual exchange requests. This method removes the exchanges from the current participant’s completedExchanges property and all participant’s exchanges property. So retain your game-specific exchange data and merge it into the match data, before you invoke this method.

## See Also

### Exchanging Data Between Participants

- [sendExchange(to:data:localizableMessageKey:arguments:timeout:completionHandler:)](gamekit/gkturnbasedmatch/sendexchange(to:data:localizablemessagekey:arguments:timeout:completionhandler:).md)
- [Exchange Timeouts](gamekit/exchange-timeouts.md)
- [exchangeDataMaximumSize](gamekit/gkturnbasedmatch/exchangedatamaximumsize.md)
- [exchangeMaxInitiatedExchangesPerPlayer](gamekit/gkturnbasedmatch/exchangemaxinitiatedexchangesperplayer.md)
- [activeExchanges](gamekit/gkturnbasedmatch/activeexchanges.md)
- [completedExchanges](gamekit/gkturnbasedmatch/completedexchanges.md)
- [exchanges](gamekit/gkturnbasedmatch/exchanges.md)
