I'm working on an OS X app and am new to Swift and OS X development. I have a window that I want to be modal and at times will have a lot of content to display so I want to allow it to enter FullScreen mode. The window nib and the code below accomplish this but exiting FullScreen mode causes the window to disappear. If I go to another desktop and return, the window is back. Below is my app delegate code.
import Cocoa
class AppDelegate: NSObject, NSApplicationDelegate {
let theApp: NSApplication = NSApplication.sharedApplication()
var fooController: FooController?
func applicationDidFinishLaunching(aNotification: NSNotification?) {
// Insert code here to initialize your application
}
@IBAction func sessionFoo(sender: AnyObject) {
if fooController == nil {
fooController = FooController(windowNibName: "FooWindow")
}
// This works when it returns from FullScreen but isn't modal
// fooController!.showWindow(self)
// This is modal but the window disappears when returning from FullScreen
theApp.runModalForWindow(fooController!.window)
}
}
In the Attributes Inspector for the window:
The following are checked:
Shadow
Close
Resize
Restorable
Deferred (for Memory)
Everything is "Inferred Behavior"
Full Screen is "Primary Window", I tried "Auxiliary Window" with no luck.
Memory is "Buffered".
This a secondary window for a Document Based app. What am I missing? Thanks.