The exchange information sent between players even when a player is not the current player.


class GKTurnBasedExchange : NSObject


All exchanges must include the current turn holder, as only the current turn holder is allowed to update the game status. Exchanges have the following workflow:

  • A player specifies a timeout and passes a small amount of data.

  • The receiving player(s) get a push notification and receive the exchange the next time they launch the game.

  • Depending on the type of exchange, the receiver may reply to the exchange and send a small amount of data back to the sender.

  • The sender gets a push notification after all receivers have responded or timed-out and gets the reply the next time they launch the game.

  • The exchange is complete and the turn holder is notified. The turn holder then applies the results of the exchange to the match data and marks it as resolved.


Responding to an Exchange

var completionDate: Date?

The date when the exchange was completed.

var data: Data?

Data that is sent with the exchange.

var exchangeID: String

A persistent identifier that is used when referring to this exchange.

var message: String?

The localized message that is pushed to all of the recipients of the exchange.

var recipients: [GKTurnBasedParticipant]

The players to receive the exchange.

var sendDate: Date

The date that the exchange was sent out.

var sender: GKTurnBasedParticipant

The participant who sent the exchange.

var status: GKTurnBasedExchangeStatus

The current status of the exchange.

enum GKTurnBasedExchangeStatus

The status of an exchange or reply.

var timeoutDate: Date?

The amount of time the exchange is to stay active before timing out.


Exchange Timeouts

The amount of time that passes before an exchange time outs.


Inherits From

Conforms To

See Also

Turn-based Games

class GKTurnBasedMatch

An object used to implement turn-based matches between sets of players on Game Center.

class GKTurnBasedExchangeReply

The player’s response to an exchange.

class GKTurnBasedParticipant

The information that describes a participant in a turn-based match.

protocol GKTurnBasedEventListener

The protocol you implement to handle exchanges and match-related events for turn-based games.