title: NSButton not masking to bounds
body: <p>I am transferring an app for iOS to a toolbar app in OSX. Although I am using swift, the objects are rather different. I am having one major problem, however, that I cannot seem to overcome.</p>
  
  <p>The code below produces the NSButton shown, but I cannot get rid of the grey background. masktobound has no effect. I have tried masking each corner individually, no effect. I just want a simple round button.</p>
  
  <p>I also have several buttons with rounded corners, however these also show the light grey background.</p>
  
  <p>Any pointers? Sample code would be appreciated.</p>
  
  <p><a href="https://i.stack.imgur.com/NProm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NProm.png" alt="circular button, code below"></a></p>
  
  <pre><code>let connectButton = NSButton.init(title: NSLocalizedString(" ", comment: "OnButtonAccessibility"), target: self, action: #selector(toggle))
  connectButton.wantsLayer = true
  connectButton.isBordered = false
  connectButton.layer?.masksToBounds=true
  if #available(OSX 10.13, *) {
    connectButton.layer?.maskedCorners=[.layerMaxXMaxYCorner]
  } else {
  
  connectButton.layer?.backgroundColor = NSColor.blue.cgColor
  connectButton.layer?.cornerRadius=80
  connectButton.layer?.borderColor=DarkerBlue.cgColor
  connectButton.layer?.borderWidth=3
  (connectButton.cell as! NSButtonCell).isBordered=false
  (connectButton.cell as! NSButtonCell).backgroundColor=NSColor.clear
  connectButton.isTransparent=true
  connectButton.frame=CGRect(x: 80, y: self.view.frame.size.height-260, width: 160, height: 160)
  connectButton.tag=1002
  self.view.addSubview(connectButton)
  </code></pre>