---
title: "download(_:decideDestinationUsing:suggestedFilename:completionHandler:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkdownloaddelegate/download(_:decidedestinationusing:suggestedfilename:completionhandler:)"
---

# download(_:decideDestinationUsing:suggestedFilename:completionHandler:)

Asks the delegate to provide a file destination where the system should write the download data.

## Declaration

```swift
func download(_ download: WKDownload, decideDestinationUsing response: URLResponse, suggestedFilename: String, completionHandler: @escaping @MainActor @Sendable (URL?) -> Void)
```

```swift
func download(_ download: WKDownload, decideDestinationUsing response: URLResponse, suggestedFilename: String) async -> URL?
```

## Parameters

- `download`: The download that needs a file destination where the systems should write the download data.
- `response`: A response from the server for an HTTP request, or a synthesized response for a blob download.
- `suggestedFilename`: A string with a filename suggestion to use in creating the file destination.
- `completionHandler`: A closure you invoke with a destination file URL to begin the download, or nil to cancel the download.

## Discussion

Discussion The suggested filename can come from the response or from the web content. The destination file URL must meet the following requirements: It’s a file that doesn’t exist. It’s in a directory that exists. It’s in a directory that WebKit can write to.

## See Also

### Tracking Download Progress

- [downloadDidFinish(_:)](webkit/wkdownloaddelegate/downloaddidfinish(_:).md)
- [download(_:didFailWithError:resumeData:)](webkit/wkdownloaddelegate/download(_:didfailwitherror:resumedata:).md)
