title: How to change Corner Radius of NSView in Swift Language
body: <p>changing corner radius of NSView should be pretty straight forward however i am getting error message "fatal error: Can't unwrap Optional.None". is there a chance i am doing this with 10.9 not 10.10 and this is happening due framework differences? or the code is wrong.  </p>
  
  <pre><code>class aRoundView: NSView {
  
      let cornerRad = 5.0
  
      init(frame: NSRect) {
          super.init(frame: frame)
  
          self.layer.cornerRadius  = cornerRad
      }
  
      override func drawRect(dirtyRect: NSRect)
      {
          super.drawRect(dirtyRect)
          NSColor.redColor().setFill()
          NSRectFill(dirtyRect)
      }
  }
  </code></pre>
  
  <h1>EDIT</h1>
  
  <p>calling it in </p>
  
  <pre><code>func applicationDidFinishLaunching(aNotification: NSNotification?) {
  
      let aView = mainViewTest(frame: NSMakeRect(0, 0, 100, 100))
      self.window.contentView.addSubview(aView)
  
  }
  </code></pre>
  
  <p>actually it is not just that. any iteration with self.layer gives same result, backgroundcolor etc.</p>