func test(){
let urls = ["https://www.sample-videos.com/zip/30mb.zip", "https://www.sample-videos.com/zip/30mb.zip", "https://www.sample-videos.com/zip/30mb.zip"].compactMap { URL(string: $0) }
for i in urls{
let destination: DownloadRequest.Destination = { _, _ in
var documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
documentsURL.appendPathComponent("duck.zip")
return (documentsURL, [.removePreviousFile])
}
AF.download(i, to: destination).downloadProgress(closure: { progess in
print(progess.fractionCompleted * 100)
}).responseData { response in
print(response)
}
}
}
printed values -
0.6780020344008234 0.9387720476319094 0.9909260502781266 1.0430800529243438 0.7301560370470407 1.0952340555705609 1.1473880582167781 0.7823100396932579 0.834464042339475 1.1995420608629954 0.8866180449856922 1.2516960635092125 1.3038500661554298 1.3560040688016468 1.408158071447864 1.5124660767402984 1.5646200793865157 1.6167740820327328 0.9387720476319094 0.9909260502781266 1.0430800529243438 1.0952340555705609 1.1473880582167781 1.1995420608629954 1.2516960635092125 0.7301560370470407 0.7823100396932579 0.834464042339475 1.66892808467895 1.8253900926176014 1.8775440952638187 0.8866180449856922 1.3038500661554298 1.3560040688016468 0.9909260502781266 1.408158071447864 1.4603120740940814 1.9818521005562533 1.5646200793865157 1.0430800529243438 2.0340061032024703 1.6167740820327328 2.0861601058486876 1.66892808467895 2.1383141084949044 2.1904681111411217 1.7732360899713844 1.0952340555705609 1.8775440952638187 1.1473880582167781 1.9296980979100358 2.242622113787339 2.346930119079773 1.1995420608629954 2.0340061032024703 1.2516960635092125 2.503392127018425