Instance Property

matchData

Game-specific data that reflects the details of the match.

Declaration

var matchData: Data? { get }

Discussion

Although Game Center knows who is participating in the match and who is expected to act next, it does not know anything about your game’s internal logic. Your game provides the match data and all the programming logic required to interpret it. This data should include the current state of the game and provide any necessary details about what actions the current player is expected to take. It can also be helpful for your game to record information about recent moves made by other players. The game can then replay those moves visually for the player to show exactly how the match reached the state it is in now.

Your game never directly updates the match state associated with this property. Instead, when the data is updated to reflect the actions of the current player, your game serializes the updated state into memory and calls one of the match’s instance methods that transmit the updated state to Game Center.

The value of this property is nil until after your game calls the loadMatchData(completionHandler:) method and the load task is complete. After this task completes, the matchData property holds the data that the last player to act transmitted to Game Center.

See Also

Retrieving Information About the Match

var participants: [GKTurnBasedParticipant]

Information about the players participating in the match.

var currentParticipant: GKTurnBasedParticipant?

The participant whose turn it is to act next.

var matchDataMaximumSize: Int

Returns the limit the Game Center servers place on the size of the match data.

var message: String?

A message displayed to all players in the match.

var creationDate: Date

The date that the match was created.

var matchID: String

A string that uniquely identifies the match.

var status: GKTurnBasedMatch.Status

The current state of the match.

enum GKTurnBasedMatch.Status

The different states that a match can enter.