Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Minimal Swift 4.2 GUI Application without Xcode
import AppKit
let app = NSApplication.shared
app.setActivationPolicy(.regular)
let window = NSWindow(
contentRect: NSMakeRect(0, 0, 640, 480),
styleMask: [.titled, .closable],
backing: .buffered,
defer: true
)
window.title = "Hello, world!"
window.makeKeyAndOrderFront(nil)
app.activate(ignoringOtherApps: true)
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment