So I have this weird issue with a UIProgressView. I run a background task via Alamofire fetching some objects through a custom api. Each time a group of objects gets fetched I want to show that through that progressView. However, the progress indicator does not move along the assigned progress but only as soon as the entire progress is finished it just jumps to 100% in one go. The progress is transferred from the background from another class via delegate and its been displayed correctly in log prints. BUT the progressView is not moving alongside.
It gets triggered by:
delegate?.updateProgressF?(progressText: "Some Text", progress: 0.1)
And the Function:
func updateProgressF(progressText: String, progress: CGFloat) {
let date = Date()
let calendar = Calendar.current
let seconds = calendar.component(.second, from: date)
let nanoSeconds = calendar.component(.nanosecond, from: date)
print(progress, seconds, nanoSeconds, progressView.progress)
DispatchQueue.main.async { [self] in
progressView.setProgress(Float(progress), animated: true)
}
}
It prints:
0.1 23 123411059 0.0
0.2 28 800351977 0.0
0.4 28 804774999 0.0
0.6 28 806638002 0.0
0.8 28 885470032 0.0
0.9 32 190487980 0.0
1.0 32 253463029 0.9
Any advice is much appreciated