how can i update my progress bar step by step?
<p>i have code where i add one constant every second to my array, how can i update my progress bar every second when array is changed?</p>

<pre><code>var array: [Int] = []

override func viewWillAppear(_ animated: Bool) {
        upgradeArray()
    }

    func upgradeArray() {
        for i in 0...10 {
            sleep(1)
            array.append(i)
            print(i)
            let percentProgress = Float(Float(self.array.count)*100.0/10.0)
            progressBar.setProgress(percentProgress, animated: true)
        }

    }
</code></pre>