saveMergedMatch(_:withResolvedExchanges:completionHandler:)
Saves match data for completed exchanges without ending the turn.
Declaration
func saveMergedMatch(_ matchData: Data, withResolvedExchanges exchanges: [GKTurnBasedExchange], completionHandler: (@Sendable ((any Error)?) -> Void)? = nil)func saveMergedMatch(_ matchData: Data, withResolvedExchanges exchanges: [GKTurnBasedExchange]) async throwsParameters
- 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:
- error
Describes an error if it occurs, or
nilif the operation completes.
Mentioned in
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.