I have a test project with a bar progress indicator create on Ventura with Xcode 14.3.1., It does not show the any animation until the @IBAction function completes.
I want to show progress as it progresses not a just the end? Any ideas how to fix this? Below is my test project code..
//
// ViewController.swift
// ProgressTest
//
// Created by Bob on 6/5/23.
//
import Cocoa
class ViewController: NSViewController {
@IBOutlet weak var progressIndicator: NSProgressIndicator!
// var progress: Double = 0.0
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override var representedObject: Any? {
didSet {
// Update the view, if already loaded.
}
}
@IBAction func progressStart(_ sender: Any) {
// Start the progress animation
progressIndicator.startAnimation(self)
// Do some work here...
// Do some work here...
var progress: Double = 0.0
for _ in 0..<100 {
// Update the progress value in a loop
progress += 1.0
progressIndicator.doubleValue = progress
// progress = Double(i)
// progressIndicator.increment(by: 10)
// progressIndicator.doubleValue = progress
// Do some work here...
}
// Stop the progress animation
progressIndicator.stopAnimation(self)
}
}
thanks
Bob