loadMatchData(completionHandler:)
Fetches your game-specific data that you store in Game Center when ending a turn, saving a turn, or leaving a match.
Declaration
func loadMatchData(completionHandler: (@Sendable (Data?, (any Error)?) -> Void)? = nil)func loadMatchData() async throws -> Data?Parameters
- completionHandler:
The block that GameKit calls when it completes the request.
The block receives the following parameters:
- matchData
The match data you pass to
GKTurnBasedMatchmethods that GameKit stores in Game Center, ornilif an error occurs.- error
Describes an error if it occurs, or
nilif the operation completes.
Discussion
The matchData property is nil until you fetch the data from Game Center using this method.