<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GameKit",
  "identifier" : "/documentation/GameKit/GKTurnBasedExchange",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "GameKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKTurnBasedExchange"
  },
  "title" : "GKTurnBasedExchange"
}
-->

# GKTurnBasedExchange

Exchange request information that participants send in a turn-based match.

```
class GKTurnBasedExchange
```

## Overview

GameKit sends exchange objects to [`GKTurnBasedEventListener`](/documentation/GameKit/GKTurnBasedEventListener) protocol methods when the local player receives an exchange request or recipients reply to an exchange request. The exchange object encapsulates your custom game data that you want to communicate to other players.

You initiate an exchange request using the `GKTurnBasedMatch` [`sendExchange(to:data:localizableMessageKey:arguments:timeout:completionHandler:)`](/documentation/GameKit/GKTurnBasedMatch/sendExchange(to:data:localizableMessageKey:arguments:timeout:completionHandler:)) method. Then GameKit sends the request to the recipients passing the exchange object to the `GKTurnBasedEventListener` [`player(_:receivedExchangeRequest:for:)`](/documentation/GameKit/GKTurnBasedEventListener/player(_:receivedExchangeRequest:for:)) protocol method. GameKit sets the status of the exchange object to [`GKTurnBasedExchangeStatus.active`](/documentation/GameKit/GKTurnBasedExchangeStatus/active).

After all recipients respond to the request, using the [`reply(withLocalizableMessageKey:arguments:data:completionHandler:)`](/documentation/GameKit/GKTurnBasedExchange/reply(withLocalizableMessageKey:arguments:data:completionHandler:)) method, or exceed the time out specified in the request, GameKit sends the exchange to the sender and the current participant. GameKit sets the exchange status to [`GKTurnBasedExchangeStatus.complete`](/documentation/GameKit/GKTurnBasedExchangeStatus/complete) and then passes it to the `GKTurnBasedEventListener` [`player(_:receivedExchangeReplies:forCompletedExchange:for:)`](/documentation/GameKit/GKTurnBasedEventListener/player(_:receivedExchangeReplies:forCompletedExchange:for:)) method.

Before the current participant ends their turn, save the completed exchanges using the `GKTurnBasedMatch` [`saveMergedMatch(_:withResolvedExchanges:completionHandler:)`](/documentation/GameKit/GKTurnBasedMatch/saveMergedMatch(_:withResolvedExchanges:completionHandler:)) method. Get the exchanges from the match object using the [`completedExchanges`](/documentation/GameKit/GKTurnBasedMatch/completedExchanges) property. Alternatively, save exchange data in the [`player(_:receivedExchangeReplies:forCompletedExchange:for:)`](/documentation/GameKit/GKTurnBasedEventListener/player(_:receivedExchangeReplies:forCompletedExchange:for:)) protocol method when all recipients reply to specific exchange requests.

To cancel an active or complete exchange, use the [`cancel(withLocalizableMessageKey:arguments:completionHandler:)`](/documentation/GameKit/GKTurnBasedExchange/cancel(withLocalizableMessageKey:arguments:completionHandler:)) method. GameKit notifies the recipients when the player cancels an exchange, using the `GKTurnBasedEventListener` [`player(_:receivedExchangeCancellation:for:)`](/documentation/GameKit/GKTurnBasedEventListener/player(_:receivedExchangeCancellation:for:)) protocol method.

## Topics

### Retrieving Exchange Details

[`exchangeID`](/documentation/GameKit/GKTurnBasedExchange/exchangeID)

The identifier for the exchange request.

[`sender`](/documentation/GameKit/GKTurnBasedExchange/sender)

The participant who sends the exchange request to recipients.

[`recipients`](/documentation/GameKit/GKTurnBasedExchange/recipients)

The participants who receives the exchange request.

[`data`](/documentation/GameKit/GKTurnBasedExchange/data)

The game-specific exchange data that GameKit sends to participants.

[`message`](/documentation/GameKit/GKTurnBasedExchange/message)

A localized message from the sender to the recipients of an exchange request.

[`sendDate`](/documentation/GameKit/GKTurnBasedExchange/sendDate)

The date that the sender initiates the exchange request.

[`timeoutDate`](/documentation/GameKit/GKTurnBasedExchange/timeoutDate)

The date that the recipients must reply by before the exchange request times out.

### Replying to Exchange Requests

[`-  replyWithLocalizableMessageKey:arguments:data:completionHandler:`](/documentation/GameKit/GKTurnBasedExchange/reply(withLocalizableMessageKey:arguments:data:completionHandler:))

Replies to an exchange request on behalf of a recipient.

[`replies`](/documentation/GameKit/GKTurnBasedExchange/replies)

The replies from recipients of the exchange request.

[`status`](/documentation/GameKit/GKTurnBasedExchange/status)

The status of the exchange request.

[`GKTurnBasedExchangeStatus`](/documentation/GameKit/GKTurnBasedExchangeStatus)

The status of an exchange or reply.

[`completionDate`](/documentation/GameKit/GKTurnBasedExchange/completionDate)

The date when all recipients of the exchange request reply.

### Canceling Exchange Requests

[`-  cancelWithLocalizableMessageKey:arguments:completionHandler:`](/documentation/GameKit/GKTurnBasedExchange/cancel(withLocalizableMessageKey:arguments:completionHandler:))

Cancels an exchange request.

## Relationships

### Conforms To

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Equatable`](/documentation/Swift/Equatable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)