---
title: "download(_:decideDestinationWithSuggestedFilename:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsurldownloaddelegate/download(_:decidedestinationwithsuggestedfilename:)"
---

# download(_:decideDestinationWithSuggestedFilename:)

The delegate receives this message when download has determined a suggested filename for the downloaded file.

## Declaration

```swift
optional func download(_ download: NSURLDownload, decideDestinationWithSuggestedFilename filename: String)
```

## Parameters

- `download`: The URL download object sending the message.
- `filename`: The suggested filename for the download.

## Discussion

Discussion The suggested filename is either derived from the last path component of the URL and the MIME type or, if the download was encoded, from the encoding. If the delegate wishes to modify the path, it should send setDestination(_:allowOverwrite:) to download. Special Considerations The delegate will not receive this message if setDestination:allowOverwrite: has already been called for the download.

## See Also

### Download Data and Responses

- [downloadDidBegin(_:)](foundation/nsurldownloaddelegate/downloaddidbegin(_:).md)
- [download(_:didCreateDestination:)](foundation/nsurldownloaddelegate/download(_:didcreatedestination:).md)
- [download(_:didReceive:)](foundation/nsurldownloaddelegate/download(_:didreceive:)-817z3.md)
- [download(_:didReceiveDataOfLength:)](foundation/nsurldownloaddelegate/download(_:didreceivedataoflength:).md)
- [download(_:shouldDecodeSourceDataOfMIMEType:)](foundation/nsurldownloaddelegate/download(_:shoulddecodesourcedataofmimetype:).md)
- [download(_:willResumeWith:fromByte:)](foundation/nsurldownloaddelegate/download(_:willresumewith:frombyte:).md)
- [download(_:willSend:redirectResponse:)](foundation/nsurldownloaddelegate/download(_:willsend:redirectresponse:).md)
