0
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

achinthaishane
  • 77
  • 1
  • 2
  • 9
  • How do you confirm that it's incorrect? There are there files downloading concurrently. – MBT May 11 '22 at 10:00
  • @MBT when adding this to progressView it's mutating the level, which means automatically increasing and decreasing. Do you know any solution for it? – achinthaishane May 11 '22 at 11:39
  • Did you add these to a single progressView? If yes, then you have to use 3 different progressView. – MBT May 11 '22 at 11:53
  • @MBT yes implemented to a single progressView, No I want to add a single progressView – achinthaishane May 11 '22 at 12:32
  • Then the current behaviour is expected. Cause 3 files are downloaded at the same time and their download progress aren't same. That's why in progress block you get inconsistent progress. – MBT May 11 '22 at 12:50
  • @MBT it's not downloading at the same time, it's looping – achinthaishane May 12 '22 at 01:13
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/244679/discussion-between-achinthaishane-and-mbt). – achinthaishane May 12 '22 at 01:18

0 Answers0