I have made a pretty simple mac app with two windows. I am an iOS developer so I am very familiar with swift but a few of the UI elements in iOS apps don’t translate well when building OS X apps. I want to take advantage of the menu bar at the top of the screen. I want to click “New” under file which is there by default and open a new window of my initial VC. How do I do that?
I have read a bunch of posts and they have told me to build a new menu bar but I feel like there should be an easier way with the menu bar that is there by default. How do I call a specific VC even once I have managed to create an outlet or add an action for the new button? Can I just instantiate the VC like we would in iOS? I just want the easiest way to do this.
This is what I used to present the new window:
let storyboard = NSStoryboard(name: NSStoryboard.Name(rawValue: "Main"), bundle: nil)
let myWindowController = storyboard.instantiateController(withIdentifier: NSStoryboard.SceneIdentifier(rawValue: "LoginVC")) as! LoginViewController
if let window = NSApplication.shared.mainWindow
window.contentViewController = myWindowController //as! NSWindowController // just swap
}