Hello:
I am trying to open a Storyboard View from an @IBAction but the app crashes with no log output. Any help will be appreciated.
Below is the code. Lines 10 to 18 are highlighted in the code when the crash occurs.
@IBActionfunc launchMainMenu(_ sender: NSMenuItem) {
if ((mainWindowController) == nil){
var windowController : NSWindowController?
let storyboard = NSStoryboard()
func openMyWindow()
{
if let vc = storyboard.instantiateController(withIdentifier: "4554") as? ViewController
{
let myWindow = NSWindow(contentViewController: vc)
myWindow.makeKeyAndOrderFront(self)
let controller = NSWindowController(window: myWindow)
controller.showWindow(self)
}
}
openMyWindow()
}
}