If you want the view transparent but not the label, set the view color to clear color and set the label background color to the color you want it to be.
I tried that before asking and it did not work. Now I see the problem is that the window also is transparent. It is the window and not the NSView that makes the label trans. So I update the question. How to make the label non transparent if the window is transparent?
view.window?.isOpaque = false
view.window?.backgroundColor = NSColor.clear
Just take the label out of the view (it will appear above NSView1 in the list of objects in the window
You can do it by dragging the Label1 in the list of objects in IB above the NSView1.
You will see the object move on the canvas.
but you can still set constraint so that it centers on NSView1.
Then call Editor > Resolve Layout to update frames on selected label.
PS: var names should begin by lowercase, as label1.