Xcode 8 Beta Doesn't Display Bare-Bones App Window

128 Views Asked by At

I created a new macOS project in Xcode 8.0 beta 4 and tried running the bare-bones app before fleshing it out. In Xcode 8, the app's window never opens; but when I use Xcode 7.3.1 it does. Other, more fleshed-out apps display fine in Xcode 8. What's wrong?

I removed the window object from MainMenu.xib, but I created another window automatically in MainWindowController.xib, when I created MainWindowController.swift. Here's my code (with comments removed), which seems pretty standard:

AppDelegate.swift:

import Cocoa

@NSApplicationMain

class AppDelegate: NSObject, NSApplicationDelegate {

var mainWindowController: MainWindowController?

    func applicationDidFinishLaunching(aNotification: NSNotification) {
        let mainWindowController = MainWindowController()
        mainWindowController.showWindow(self)
        self.mainWindowController = mainWindowController
    }
}

MainWindowController.swift:

import Cocoa

class MainWindowController: NSWindowController {

    override var windowNibName: String {
        return "MainWindowController"
    }
    override func windowDidLoad() {
        super.windowDidLoad()
    }
}

That's all there is to it. In Xcode 7.3.1 an empty window opens; it Xcode 8.0 beta 4 the app starts but the window never opens. It would be helpful to know what the critical difference in Xcode 8 (beta) is between a slightly more fleshed out app that does display and one that does not.

0

There are 0 best solutions below