If someone is looking for a version of Swift (based on @WarrenBurtons answer).
Appdelegate
@NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { var window: NSWindow? func applicationDidFinishLaunching(_ aNotification: Notification) {
Subclass of NSApplication
import Cocoa class Application: NSApplication { let strongDelegate = AppDelegate() override init() { super.init() self.delegate = strongDelegate } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } }
Record Info.plist
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> ... <key>NSPrincipalClass</key> <string>$(PRODUCT_MODULE_NAME).Application</string> ... </dict> </plist>
I also created the gist of this to keep me up to date with the new versions of Xcode / Swift. https://gist.github.com/florieger/7ac5e7155f6faf18666f92f7d82f6cbc
Edit: Be sure to remove Main.storyboard / MainMenu.xib, otherwise you can get two Windows in the user interface debugger.
florieger
source share