title: black box around drawRect shape swift
body: <p>I'm trying to learn Core Graphics and I have having this problem when using drawRect. (picture below)</p>
  
  <p>I made a class that inherits from UIView which has the drawRect code. From my viewcontroller class, I than set the dimensions and add the subview.</p>
  
  <p>The result is getting the image with a black box around my shape. How can I fix this?</p>
  
  <pre><code>class myViewController: UIViewController {
  
  var bg = Background()
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      bg = Background(frame: CGRectMake(50, 50, 50, 50))
      self.view.addSubview(bg)
      self.view.sendSubviewToBack(bg)
  }
  
  
  class Background: UIView {
  
  override func drawRect(rect: CGRect) {
      // Drawing code
  
      var path = UIBezierPath(ovalInRect: rect)
      UIColor.greenColor().setFill()
      path.fill()
  
    }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/j4VC6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j4VC6.png" alt="enter image description here"></a></p>