---
title: "init(request:delegate:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nsurldownload/init(request:delegate:)"
---

# init(request:delegate:)

Returns an initialized URL download for a URL request and begins to download the data for the request.

## Declaration

```swift
init(request: URLRequest, delegate: (any NSURLDownloadDelegate)?)
```

## Parameters

- `request`: The URL request to download. The request object is deep-copied as part of the initialization process. Changes made to request after this method returns do not affect the request that is used for the loading process.
- `delegate`: The delegate for the download. This object will receive delegate messages as the download progresses. Delegate messages will be sent on the thread which calls this method. For the download to work correctly the calling thread’s run loop must be operating in the default run loop mode. The NSURLDownload class maintains a strong reference to this delegate object.

## Return Value

Return Value An initialized NSURLDownload object for request.

## See Also

### Related Documentation

- [URL Loading System](foundation/url-loading-system.md)

### Creating and configuring a download instance

- [setDestination(_:allowOverwrite:)](foundation/nsurldownload/setdestination(_:allowoverwrite:).md)
