I\'m trying to crate a NSWindow without title bar (NSBorderlessWindowMask) with round corners and a shadow, similar to the below \"Welcome
Here's a solution that can be done just with Interface Builder and two lines of extra code:
Create a NIB file in Interface Builder containing your window.
Configure it as shown below:
Add a box (NSBox) object to the window content view in Interface Builder and make it fill the entire content view. Set border style, border thickness, border color, fill color and corner radius of the box as desired:
Add all your other UI content to the box, treat is as if it was your window content view.
In your code, create a subclass of NSWindowController which loads this NIB file and thus becomes the owner. Either in -awakeFromNib or -windowDidLoad, add the following code:
self.window.opaque = NO;
self.window.backgroundColor = NSColor.clearColor;
That's all folks.
No layers, no custom drawing code, no NSBezierPath, no NSShadow.
Verified to work correctly on all systems from macOS 10.9 to 10.15