I am trying to programmatically switch to another viewController scene when a certain event happens in Xcode for a MacOS app but am having trouble. The second view controller is in the same storyboard as the one I am trying to switch from. I currently have
let secondViewController = ViewController(nibName: "outcome", bundle: nil)
self.present(secondViewController, animator: true as! NSViewControllerPresentationAnimator)
but it seems to crash when the event is triggered:
Could not cast value of type 'Swift.Bool' (0x2010043a8) to '__C.NSViewControllerPresentationAnimator' (0x2007787d0).
it also shows an error Thread 1: signal SIGABRT
on the second command where I self.present