---
title: "sendExchange(to:data:localizableMessageKey:arguments:timeout:completionHandler:)"
framework: gamekit
role: symbol
role_heading: Instance Method
path: "gamekit/gkturnbasedmatch/sendexchange(to:data:localizablemessagekey:arguments:timeout:completionhandler:)"
---

# sendExchange(to:data:localizableMessageKey:arguments:timeout:completionHandler:)

Sends an exchange request that contains your game data to one or more participants.

## Declaration

```swift
func sendExchange(to participants: [GKTurnBasedParticipant], data: Data, localizableMessageKey key: String, arguments: [String], timeout: TimeInterval, completionHandler: (@Sendable (GKTurnBasedExchange?, (any Error)?) -> Void)? = nil)
```

```swift
func sendExchange(to participants: [GKTurnBasedParticipant], data: Data, localizableMessageKey key: String, arguments: [String], timeout: TimeInterval) async throws -> GKTurnBasedExchange
```

## Parameters

- `participants`: The other participants, excluding the local player and inactive participants, that GameKit sends the exchange request to.
- `data`: The data that GameKit sends to the other participants.
- `key`: The identifier for looking up the translated message in the default Localized.strings file. If you use a formatted string with specifiers, provide the arguments.
- `arguments`: A list of arguments to substitute into the localized string if it’s formatted and contains specifiers.
- `timeout`: The length of time a participant has to respond to the exchange request. The maximum value is 90 days.
- `completionHandler`: The block that GameKit calls when it completes the request. The block receives the following parameters:

## Mentioned in

Exchanging data between players in turn-based games

## Discussion

Discussion If your game isn’t running or is in the background on recipient devices, a notification containing the localized message you pass to this method appears. When the participant taps or clicks the notification, GameKit launches or brings the game to the foreground and then invokes the player(_:receivedExchangeRequest:for:) method. Implement the player(_:receivedExchangeRequest:for:) protocol method to handle the exchange request — for example, show an interface on the receiver’s device to accept or reject the exchange.

## See Also

### Exchanging Data Between Participants

- [Exchange Timeouts](gamekit/exchange-timeouts.md)
- [exchangeDataMaximumSize](gamekit/gkturnbasedmatch/exchangedatamaximumsize.md)
- [exchangeMaxInitiatedExchangesPerPlayer](gamekit/gkturnbasedmatch/exchangemaxinitiatedexchangesperplayer.md)
- [activeExchanges](gamekit/gkturnbasedmatch/activeexchanges.md)
- [completedExchanges](gamekit/gkturnbasedmatch/completedexchanges.md)
- [exchanges](gamekit/gkturnbasedmatch/exchanges.md)
- [saveMergedMatch(_:withResolvedExchanges:completionHandler:)](gamekit/gkturnbasedmatch/savemergedmatch(_:withresolvedexchanges:completionhandler:).md)
