2

When a document based application becomes active, and there are no open windows, a new document window is automatically created. I want to prevent this behavior and show my "Choose a Template" dialog instead of creating a blank document by default.

As you can see on the screenshot, the new document is created somewhere in NSApplicationMain.

enter image description here

How can I prevent this and show my window instead?

1 Answers1

5

Found the answer myself, I was just looking in the wrong place. The creation of untitled documents is handled in the application delegate, so returning false from

func applicationShouldOpenUntitledFile(sender: NSApplication) -> Bool {
  return false
}

did the trick.