<!--
{
  "availability" : [
    "iOS: 7.0.0 - 27.0.0",
    "iPadOS: 7.0.0 - 27.0.0",
    "macCatalyst: 13.1.0 - 27.0.0",
    "macOS: 10.10.0 - 27.0.0",
    "tvOS: 10.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "MultipeerConnectivity",
  "identifier" : "/documentation/MultipeerConnectivity/MCSession/send(_:toPeers:with:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Multipeer Connectivity"
    ],
    "preciseIdentifier" : "c:objc(cs)MCSession(im)sendData:toPeers:withMode:error:"
  },
  "title" : "send(_:toPeers:with:)"
}
-->

# send(_:toPeers:with:)

Sends a message to nearby peers.

```
func send(_ data: Data, toPeers peerIDs: [MCPeerID], with mode: MCSessionSendDataMode) throws
```

## Parameters

`data`

An instance containing the message to send.

`peerIDs`

An array of peer ID instances representing the peers that should receive the message.

`mode`

The transmission mode to use (reliable or unreliable delivery).

## Discussion

This method is asynchronous (nonblocking).

On the recipient device, the session instance calls its delegate instance’s [`session(_:didReceive:fromPeer:)`](/documentation/MultipeerConnectivity/MCSessionDelegate/session(_:didReceive:fromPeer:)) method with the message after it has been fully received.

---

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)