Skip to content

Instantly share code, notes, and snippets.

@asukakenji
Created November 29, 2018 11:31
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asukakenji/b89ce54d771843100ce19d76c89b3a68 to your computer and use it in GitHub Desktop.
Save asukakenji/b89ce54d771843100ce19d76c89b3a68 to your computer and use it in GitHub Desktop.
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