[ad_1]
that is viewcontroller file
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var ProgressLabel: UILabel!
@IBOutlet weak var progressBar: UIProgressView!
let progress = Progress(totalUnitCount: 10)
override func viewDidLoad() {
tremendous.viewDidLoad()
}
@IBAction func StartCount(_ sender: Any) {
// 1
progressBar.progress = 0.0
progress.completedUnitCount = 0
// 2
Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { (timer) in
guard self.progress.isFinished == false else {
timer.invalidate()
return
}
// 3
self.progress.completedUnitCount += 1
self.progressBar.setProgress(Float(self.progress.fractionCompleted), animated: true)
self.ProgressLabel.textual content = "(Int(self.progress.fractionCompleted * 100)) %"
}
}
}
that is an instance of progress bar can some one make me perceive what’s the code
[ad_2]
