I managed to draw a rect :-) But I don\'t know how to draw a rounded rect.
Can someone help me out with the following code how to round the rect?
let
@muku answer in Swift 4.x+:
override func draw(_ rect: CGRect) { super.draw(rect) let clipPath = UIBezierPath(roundedRect: rect, cornerRadius: 6.0).cgPath let ctx = UIGraphicsGetCurrentContext()! ctx.addPath(clipPath) ctx.setFillColor(UIColor.red.cgColor) ctx.closePath() ctx.fillPath() }