0

I have implemented a UIProgressView which goes by the upload status of files.

Everything works properly, but since I'm using CloudKit, the perRecordProgressBlock method gives me chunk-positions of the upload status instead of smooth progress feedback.

So far so good, but since I'm using that perRecordProgressBlock as a data source of my UIProgressView, the progress goes something like 0.0, 0.15, 0.75, 0.99, and so, the progress goes up block-by-block and I want to make that transition smoother.

When it goes from 0.15 to 0.75, instead of jumping straight to 0.75, can I make it animate to that position? Making it smoother?

Thanks.

Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223
Ivan Cantarino
  • 3,058
  • 4
  • 34
  • 73

1 Answers1

1

Use animated: true when modifying the progress.

progressView.setProgress(0.99, animated: true)

If you want to set a custom transition time, set animated to false and put the code inside a UIView animate block.

UIView.animate(withDuration: 0.35) {
    self.progressView.setProgress(0.99, animated: false)
}
Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223