ios – Swift 4 view with curved center

guys, I have trouble creating a user interface. I've tried to create a custom view, but I can not even see the background of this view. Here is my code example, I took it in another post, but I do not know how to change it for my case.

enter the description of the image here

J & # 39; uses SnapKit for my user interface elements.

My opinion:

lazy var greenView: CurvedView = {
let view = CurvedView ()
view.backgroundColor = #colorLiteral (red: 0,08778516203, green: 0,7643524408, blue: 0,1997725368, alpha: 1)
DispatchQueue.main.async {
view.snp.makeConstraints {(make) -> Cancel in
make.top.equalTo (self.shipView.snp.bottom) .offset (100)
make.left.right.equalTo (self.scrollContentView)
make.height.equalTo (200)
}
}
return the view
} ()

I tried to create a custom view:

                CurvedView class: UIView {
redefines func draw (_ rect: CGRect) {
leave it there: CGFloat = 20
let curveTo: CGFloat = 0
leave myBezier = UIBezierPath ()
myBezier.move (to: CGPoint (x: 0, y: y))
myBezier.addQuadCurve (to: CGPoint (x: rect.width, y: y), controlPoint: CGPoint (x: rect.width / 2, y: curveTo))
myBezier.addLine (to: CGPoint (x: rect.width, y: rect.height))
myBezier.addLine (to: CGPoint (x: 0, y: rect.height))
myBezier.close ()
leave context = UIGraphicsGetCurrentContext ()
context! .setLineWidth (4.0)
UIColor.white.setFill ()
myBezier.fill ()
backgroundColor = .red
}

override init (frame: CGRect) {
super.init (frame: frame)
self.backgroundColor = UIColor.clear
}

Required init? (encoder aDecoder: NSCoder) {
super.init (encoder: aDecoder)
self.backgroundColor = UIColor.clear

}
}

https://d.radikal.ru/d30/1902/c5/c07cac5532d0.png