I want to show an NSAlert sheet modal when my single-window app first launches, but doing so makes the window jump when it first opens.
The window is restoring the user's last chosen size & position (I have set the "Autosave name" in IB). This works, but appears to be done AFTER my code that shows the modal sheet.
I'm only really talking about the following 3 lines of code:
override func viewDidAppear() {
let alert = NSAlert.init()
alert.beginSheetModal(for: self.view.window!) { (returnCode: NSModalResponse) -> Void in
}
}I'm guessing viewDidAppear() doesn't mean the window has finished positioning and sizing itself from the user defaults, but for the life of me cannot find a method that gives this to me.
Since a picture is worth a thousand words, I've put up a demo at https://github.com/jeff-h/WindowPositioning