UIProgressView has a function called setProgress
that doesn't have a completion handler.
I would like to execute code after the progress has been animated like this:
self.setProgress(1, animated: true)
How can I do that using Swift?
EDIT:
In order to animate the progressView, I added this function inside the subclass
func makeProgress(with duration: Double) {
self.progress = 0.0
progressLevel.completedUnitCount = 0
isHidden = false
Timer.scheduledTimer(withTimeInterval: (duration/(units-20)), repeats: true) { (timer) in
guard self.progressLevel.isFinished == false else {
timer.invalidate()
return
}
self.progressLevel.completedUnitCount += 1
self.setProgress(Float(self.progressLevel.fractionCompleted), animated: true)
}
}