How to show full screen window programmatically in macOS

Issue #242

let window = NSWindow(contentRect: mainScreen.frame, styleMask: .borderless, backing: .buffered, defer: false)
window.level = .floating
window.contentView = NSView()
window.makeKeyAndOrderFront(NSApp)
NSApp.activate(ignoringOtherApps: true)

and then later hide it

window.orderOut(NSApp)
Written by

I’m open source contributor, writer, speaker and product maker.

Start the conversation