---
title: "connection(_:didReceive:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsurlconnectiondatadelegate/connection(_:didreceive:)-8p5vg"
---

# connection(_:didReceive:)

Sent as a connection loads data incrementally.

## Declaration

```swift
optional func connection(_ connection: NSURLConnection, didReceive data: Data)
```

## Parameters

- `connection`: The connection sending the message.
- `data`: The newly available data. The delegate should concatenate the contents of each data object delivered to build up the complete data for a URL load.

## Discussion

Discussion This method provides the only way for an asynchronous delegate to retrieve the loaded data. It is the responsibility of the delegate to retain or copy this data as it is delivered.

## See Also

### Handling Incoming Data

- [connection(_:didReceive:)](foundation/nsurlconnectiondatadelegate/connection(_:didreceive:)-8t66w.md)
