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 canvas = UIGraphicsGetCurrentContext()
rec = CGRectMake(0, 0, 40, 40);
//var maskPath = UIBezierPath(roundedRect: rec, byRoundingCorners: .BottomLeft | .BottomRight, cornerRadii: CGSize(width: 3, height: 3))
CGContextAddRect(canvas, rec);
CGContextFillPath(canvas);
How to create a rounded corner rectangle using BezierPath
var roundRect = UIBezierPath(roundedRect: <CGRect>, byRoundingCorners: <UIRectCorner>, cornerRadii: <CGSize>)
Or for an example with values:
var roundRect = UIBezierPath(roundedRect: CGRectMake(0, 0, 100, 100), byRoundingCorners:.AllCorners, cornerRadii: CGSizeMake(16.f, 16.f))