<!--
{
  "availability" : [
    "iOS: 14.5.0 -",
    "iPadOS: 14.5.0 -",
    "macCatalyst: 14.5.0 -",
    "macOS: 11.3.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKDownloadDelegate/download(_:decideDestinationUsing:suggestedFilename:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(pl)WKDownloadDelegate(im)download:decideDestinationUsingResponse:suggestedFilename:completionHandler:"
  },
  "title" : "download(_:decideDestinationUsing:suggestedFilename:completionHandler:)"
}
-->

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

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

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

## 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

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.

---

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)