I have a UIView subclass which contains only the following:
drawRect(rect: CGRect) {
let ctx: CGContext? = UIGraphicsGetCurrentContext()
let radius: CGFloat = rect.width / 2
let endAngle = CGFloat(2 * M_PI)
CGContextAddArc(ctx, bounds.width / 2, bounds.height / 2, radius, 0, endAngle, 1)
CGContextSetStrokeColorWithColor(ctx, UIColor.blackColor().CGColor)
CGContextSetFillColorWithColor(ctx, UIColor.whiteColor().CGColor)
CGContextSetLineWidth(ctx, 4.0)
CGContextDrawPath(ctx, CGPathDrawingMode.FillStroke)
}
I do not call any init() functions, but the object is still drawn.
Additionally, when I attempt to implement an init() function, I am given several errors regarding required initializations.
So my question is : How am I able to create a UIView object without an init() function?