I have a view with a loading bar on my story board. While my code is operating i want the loading bar to proceed. Once it is finished i want to load another view controller with a button.
I tried this by loading a new view Controller but i don't have any Idea what the animator is. Here is my code.
What do i have to use for animator? I'm i getting the concept of the storyboard wrong?
override func viewDidAppear() {
super.viewDidAppear()
var deadlineTime = DispatchTime.now() + .seconds(1)
progressView.style = NSProgressIndicatorStyle(rawValue: 0)!;
progressView.startAnimation(self);
DispatchQueue.main.asyncAfter(deadline: deadlineTime) {
self.progressView.increment(by: 5)
deadlineTime = DispatchTime.now() + .seconds(1)
DispatchQueue.main.asyncAfter(deadline: deadlineTime) {
deadlineTime = DispatchTime.now() + .seconds(1)
self.progressView.increment(by: 10)
DispatchQueue.main.asyncAfter(deadline: deadlineTime) {
self.progressView.increment(by: 20)
self.progressView.stopAnimation(self)
//self.performSegue(withIdentifier: "bla", sender: self)
self.switchScreen()
}
}
}
}
func switchScreen(){
let main = NSStoryboard(name: "Main", bundle: Bundle.main)
let vc = self.storyboard?.instantiateController(withIdentifier: "finished") as! NSViewController
self.presentViewController(vc, animator: ???)
}