My code below has no limits and eventually goes to the end of the progress view without stopping.
I would like the progress view to go to the end of the bar within 10 seconds in 1 second intervals.
import UIKit
class ViewController: UIViewController {
@IBOutlet var progessV : UIProgressView!
var progressValue : Float = 0
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
Timer.scheduledTimer(timeInterval: 0.01, target: self, selector: #selector(update), userInfo: nil, repeats: true)
}
@objc func update(){
progressValue += 0.01
progessV.progress = progressValue
}
@IBAction func reset() {
progressValue = 0
}
}