---
title: "download(from:delegate:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/urlsession/download(from:delegate:)"
---

# download(from:delegate:)

Retrieves the contents of a URL and delivers the URL of the saved file asynchronously.

## Declaration

```swift
func download(from url: URL, delegate: (any URLSessionTaskDelegate)? = nil) async throws -> (URL, URLResponse)
```

## Parameters

- `url`: The URL to retrieve.
- `delegate`: A delegate that receives life cycle and authentication challenge callbacks as the transfer progresses.

## Return Value

Return Value An asynchronously-delivered tuple that contains the location of the downloaded file as a URL, and a URLResponse.

## See Also

### Performing asynchronous transfers

- [bytes(for:delegate:)](foundation/urlsession/bytes(for:delegate:).md)
- [bytes(from:delegate:)](foundation/urlsession/bytes(from:delegate:).md)
- [URLSession.AsyncBytes](foundation/urlsession/asyncbytes.md)
- [data(for:delegate:)](foundation/urlsession/data(for:delegate:).md)
- [data(from:delegate:)](foundation/urlsession/data(from:delegate:).md)
- [data(for:)](foundation/urlsession/data(for:).md)
- [data(from:)](foundation/urlsession/data(from:).md)
- [download(for:delegate:)](foundation/urlsession/download(for:delegate:).md)
- [download(resumeFrom:delegate:)](foundation/urlsession/download(resumefrom:delegate:).md)
- [upload(for:from:delegate:)](foundation/urlsession/upload(for:from:delegate:).md)
- [upload(for:fromFile:delegate:)](foundation/urlsession/upload(for:fromfile:delegate:).md)
- [upload(for:from:)](foundation/urlsession/upload(for:from:).md)
- [upload(for:fromFile:)](foundation/urlsession/upload(for:fromfile:).md)
- [URLSessionTaskDelegate](foundation/urlsessiontaskdelegate.md)
