Skip to content

Instantly share code, notes, and snippets.

@SilencerWeb
Created September 11, 2018 11:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SilencerWeb/c6e2fe0abccf51b636b85b49d5588e2f to your computer and use it in GitHub Desktop.
Save SilencerWeb/c6e2fe0abccf51b636b85b49d5588e2f to your computer and use it in GitHub Desktop.
import Cocoa
class WindowController: NSWindowController {
override func windowDidLoad() {
super.windowDidLoad()
print("it works!")
if let window = window, let screen = NSScreen.main {
let screenRect = screen.visibleFrame
window.setFrame(
NSRect(x: screenRect.origin.x, y: screenRect.origin.y, width: screenRect.width / 2.0, height: screenRect.height),
display: true
)
print(screenRect.origin.x, screenRect.origin.y, screenRect.width, screenRect.height)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment