Created
June 3, 2025 20:55
-
-
Save Aayush9029/75863e4f50805cfd866e1ca5a703a080 to your computer and use it in GitHub Desktop.
NSWindow AppKit that is pretty
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let windowStyles: NSWindow.StyleMask = [.titled, .utilityWindow, .hudWindow] | |
| let windowRect = NSRect.init(x: 0, y: 0, width: 600, height: 400) | |
| let window = NSPanel.init(contentRect: windowRect, styleMask: windowStyles, backing: .buffered, defer: true) | |
| window.title = "Title" | |
| window.titleVisibility = .hidden | |
| window.titlebarAppearsTransparent = true | |
| let view = NSView() | |
| window.contentView = view | |
| window.contentView?.wantsLayer = true | |
| window.contentView?.layer?.cornerRadius = 0.0 | |
| window.contentView?.layer?.borderWidth = 0.0 | |
| window.isOpaque = false | |
| window.alphaValue = 1.0 | |
| window.isMovableByWindowBackground = true | |
| window.toolbarStyle = .automatic | |
| window.animationBehavior = .utilityWindow | |
| window.center() | |
| window.makeKeyAndOrderFront(nil) | |
| NSApp.activate(ignoringOtherApps: true) |
Author
Aayush9029
commented
Jun 3, 2025

Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment