loadMatches(completionHandler:)
Fetches the turn-based matches from Game Center that the local player participates in.
Declaration
class func loadMatches(completionHandler: (@Sendable ([GKTurnBasedMatch]?, (any Error)?) -> Void)? = nil)class func loadMatches() async throws -> [GKTurnBasedMatch]Parameters
- completionHandler:
The block that GameKit calls when it completes the request.
The block receives the following parameters:
- matches
The local player’s matches, or
nilif there are none. If an error occurs, this parameter may be non-nil, containing a subset of the matches that GameKit loads before the error occurs.- error
Describes an error if it occurs, or
nilif the operation completes.
Mentioned in
Discussion
The matchData properties of the match objects are nil until you fetch the data from Game Center using the loadMatchData(completionHandler:) method.