I'm trying to call modal sheet inside my root window. I've have success with showing sheet but it is not attached to main window.
I've read about similar problem:
My application has storyboard (image below), I'm calling sheet from Root Window Controller. I've tried to call sheet from Root Split View Controller but had no success.
let loginWindow = LoginWindowController(windowNibName: "LoginWindowController")
self.window?.beginSheet(loginWindow.window!, completionHandler: { (res) -> Void in
print("completed")
})
I've tried to call beginSheet (also to display sheet you can use presentViewControllerAsSheet or performSegueWithIdentifier) within viewDidLoad method. That was the error.
You can call sheet only after view was appeared. Then sheet will be placed correctly, inside window and without window/view hierarchy errors.
Now I'm calling sheet in viewDidAppear method and everything is working