Skip to content

Instantly share code, notes, and snippets.

@johnsusek
Created March 7, 2020 14:52
Show Gist options
  • Save johnsusek/7b063a114ade0dd1070fe80494941a99 to your computer and use it in GitHub Desktop.
Save johnsusek/7b063a114ade0dd1070fe80494941a99 to your computer and use it in GitHub Desktop.
func createNewWindow() -> NSWindowController? {
let storyboard = NSStoryboard(name: "Main", bundle: nil)
guard let mainViewController = storyboard.instantiateController(withIdentifier: "OutlineViewController") as? RecallOutlineViewController else { return nil }
let newWindow = NSWindow(contentViewController: mainViewController)
newWindow.title = "Recall"
newWindow.toolbar = NSToolbar(identifier: "MainToolbar")
newWindow.makeKeyAndOrderFront(self)
let controller = NSWindowController(window: newWindow)
windowList.append(controller)
controller.showWindow(self)
return controller
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment