endMatchInTurn(withMatch:completionHandler:)
Ends the match.
Declaration
func endMatchInTurn(withMatch matchData: Data, completionHandler: (@Sendable ((any Error)?) -> Void)? = nil)func endMatchInTurn(withMatch matchData: Data) async throwsParameters
- matchData:
Your game-specific data representing the match state. For example, include information needed for the next participant to take their turn in this object. Don’t pass
nilas this parameter. - 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
Invoke this method only when the local player is the current participant. Also, set the matchOutcome property for each participant in the match’s participants property to a value other than GKTurnBasedMatch.Outcome.none before invoking this method.
To receive turn-based events that this method generates, register a listener that conforms to the GKTurnBasedEventListener protocol with the local player. See Starting turn-based matches and passing turns between players.