I am doing a analysis process on image. As I run through all pixels, I want to have a feedback about the progress. Here is my code:
for _ in 0 ..< height {
for _ in 0 ..< width {
analyzeImage(currentPixel)
currentPixel = currentPixel.successor()
}
updateProgress()
}
func updateProgress() {
self.fractionalProgress += self.fractionalRatio
if (Int(self.fractionalProgress / self.fractionalRatio) % 20) == 0 {
self.progressBar.progress = self.fractionalProgress
print(self.progressBar.progress)
}
}
I called updateProgress inside a nested for loop. The printed result is updating, but the bar is not changed visually. It is only updated at the end. Thanks for any help in advanced !!!!