How to make a smooth, rounded, volume-like OS X window with NSVisualEffectView?

Update for OS X El Capitan The hack I described in my original answer below is not needed on OS X El Capitan anymore. The NSVisualEffectView’s maskImage should work correctly there, if the NSWindow’s contentView is set to be the NSVisualEffectView (it’s not enough if it is a subview of the contentView). Here’s a sample … Read more

NSWindow contentView not cover full window size – macOS & SwiftUI

I just used the following variant in AppDelegate, the content of ContentView and others can be any func applicationDidFinishLaunching(_ aNotification: Notification) { // Create the SwiftUI view that provides the window contents. let contentView = ContentView() .edgesIgnoringSafeArea(.top) // to extend entire content under titlebar // Create the window and set the content view. window = … Read more

Keep window always on top?

To change the window level you can’t do it inside viewDidload because view’s window property will always be nil there but it can be done overriding viewDidAppear method or any other method that runs after view is installed in a window (do not use it inside viewDidLoad): Swift 4 or later override func viewDidAppear() { … Read more