I am trying to make a NSPanel that looks like this
This is initialized like that
let panel1 = NSPanel(contentRect: frame1,
styleMask: [.borderless],
backing: .buffered,
defer: true)
The thing is, when I click anywhere on the screen outside of that panel, it disappears. Only when i click on the application icon again, it comes to foreground.
With the following implementation I am getting the panel to stick on top, but there its having a border
let panel1 = NSPanel(contentRect: frame1,
styleMask: [.borderless, .nonactivatingPanel],
backing: .buffered,
defer: true)
The border (few black pixels) looks like this but is always on top.
The question
How can I have it borderless (like the first image) but always on top (like the 2nd image).
Notes
- Both variants have
level = .mainMenu - Both variants have
collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary]


I know it's been a while, but for whoever is struggling, simply add
hasShadow = falsethat will do the trick.