I want to download a file with alamo fire and using alert with progress to show it but the progress will not move when alamo fire progress.fractionCompleted increased I use static var to equal progres.fractionCompleted but it doesn't worked too here is my codes
let destination = DownloadRequest.suggestedDownloadDestination()
Alamofire.download("example.com", to: destination).downloadProgress(queue: DispatchQueue.global(qos: .utility)) { (progress) in
print("Progress: \(progress.fractionCompleted)")
sixthLevelViewController.progressdownload = Float(progress.fractionCompleted)
DispatchQueue.main.async {
let alertController = UIAlertController(title: "Downloading", message: "please wait", preferredStyle: .alert)
let progressDownload : UIProgressView = UIProgressView(progressViewStyle: .default)
progressDownload.setProgress(ViewController.progressdownload, animated: true)
progressDownload.frame = CGRect(x: 10, y: 70, width: 250, height: 0)
alertController.view.addSubview(progressDownload)
self.present(alertController, animated: true, completion: nil)
}
} .validate().responseData { ( response ) in
print(response.destinationURL!.lastPathComponent)
}
**Remember that this will work well and the problem is just updating progress view **