title: Cant Change UIView Background Color From Black
body: <p>This is my first time in which I've encountered problems with drawRect. I have a simple UIView subclass with a path to fill. Everything is fine. The path gets filled properly, but the background remains black no matter what. What should I do? My code is listed below: </p>
  
  <pre><code>var color: UIColor = UIColor.red {didSet{setNeedsDisplay()}}
  
  private var spaceshipBezierPath: UIBezierPath{
      let path = UIBezierPath()
      let roomFromTop: CGFloat = 10
      let roomFromCenter: CGFloat = 7
      path.move(to: CGPoint(x: bounds.minX, y: bounds.maxY))
      path.addLine(to: CGPoint(x: bounds.minX, y: bounds.minY+roomFromTop))
      path.addLine(to: CGPoint(x: bounds.midX-roomFromCenter, y: bounds.minY+roomFromTop))
      path.addLine(to: CGPoint(x: bounds.midX-roomFromCenter, y: bounds.minY))
      path.addLine(to: CGPoint(x: bounds.midX+roomFromCenter, y: bounds.minY))
      path.addLine(to: CGPoint(x: bounds.midX+roomFromCenter, y: bounds.minY+roomFromTop))
      path.addLine(to: CGPoint(x: bounds.maxX, y: bounds.minY+roomFromTop))
      path.addLine(to: CGPoint(x: bounds.maxX, y: bounds.maxY))
      path.addLine(to: CGPoint(x: bounds.minX, y: bounds.maxY))
      return path
  }
  
  override func draw(_ rect: CGRect) {
      color.setFill()
      spaceshipBezierPath.fill()
  }
  </code></pre>
  
  <p>Here is what the view looks like: 
  <a href="https://i.stack.imgur.com/0Iwrz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0Iwrz.png" alt="enter image description here"></a></p>