Learning from Open Source Making macOS app in code

Issue #91

I’m familiar with the whole app structure that Xcode gives me when I’m creating new macOS project, together with Storyboard. The other day I was reading touch-bar-simulator and see how it declares app using only code. See this main.swift

1
2
3
4
5
6
7
8
9
let app = NSApplication.shared
let delegate = AppDelegate()
app.delegate = delegate
app.run()

final class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
let controller = IDETouchBarSimulatorHostWindowController.simulatorHostWindowController()!
lazy var window: NSWindow = self.controller.window!
}

Comments