<!--
{
  "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/MCSessionDelegate/session(_:didReceive:fromPeer:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Multipeer Connectivity"
    ],
    "preciseIdentifier" : "c:objc(pl)MCSessionDelegate(im)session:didReceiveData:fromPeer:"
  },
  "title" : "session(_:didReceive:fromPeer:)"
}
-->

# session(_:didReceive:fromPeer:)

Indicates that an `NSData` object has been received from a nearby peer.

```
func session(_ session: MCSession, didReceive data: Data, fromPeer peerID: MCPeerID)
```

## Parameters

`session`

The session through which the data was received.

`data`

An object containing the received data.

`peerID`

The peer ID of the sender.

---

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)