macOS, Swift, Storyboards
I have two windows. I have opened the second window with a Storyboard Segue Kind Sheet. I want to close that window with a fade out. I put that in SecondViewController.swift. This works well to make the fade out. But, if I understand, the window is not visible but it is still there and I cannot click any button behind. How to solve that?
(If I use dismiss(self) I close the window but without the fade out. I want fade out, and then close)
@IBAction func close1(_ sender: NSButton) {
self.view.window?.animationBehavior = .none
self.view.window?.makeKeyAndOrderFront(nil)
NSAnimationContext.runAnimationGroup({ (context) -> Void in
context.duration = 2
self.view.window?.animator().alphaValue = 0
}, completionHandler: nil)
// dismiss(self)
}