'DownloadFileDestination' is not a member type of class 'Alamofire.DownloadRequest'

Hi, I new to iOS dev and swift/alamofire..
Currently I need to update our app, but when try to run using emulator, got error as below

"'DownloadFileDestination' is not a member type of class 'Alamofire.DownloadRequest'"

Below is the code.
let destination: DownloadRequest.DownloadFileDestination = { _, _ in
let directoryURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
let file = directoryURL.appendingPathComponent(saveUrl, isDirectory: false)
return (file, [.createIntermediateDirectories, .removePreviousFile])

Im have google and try several answer, but still not success.


Seems you've got some outdated example code. DownloadRequest.DownloadFileDestionation is DownloadRequest.Destination as of Alamofire 5. I suggest you read our documentation to get started.

Thanks for your prompt reply sir.

I have the changes as image below.

before this I'm using

var manager: SessionManager?

manager?.download(downloadUrl, method: method, to: destination)
.response { response in

is it correct to update to below? (manager?.download to AF.download)

AF.download(downloadUrl, to: destination).response { response in