I am getting error
fatal error: Can't unwrap Optional.None
(lldb)
with this code
var context:CGContextRef = UIGraphicsGetCurrentContext()
let radius:CGFloat = 5
CGContextSetRGBStrokeColor(context, 1, 1, 1, 1)
var tempRect:CGRect = CGRectMake(5, 5, 20, 20)
let minX = tempRect.minX, midX = tempRect.midX, maxX = tempRect.maxX
let minY = tempRect.minY, midY = tempRect.midY, maxY = tempRect.maxY
CGContextMoveToPoint(context, minX, minY)
CGContextAddArcToPoint(context, minX, minY, midX, midY, radius)
CGContextAddArcToPoint(context, maxX, minY, maxX, midY, radius)
CGContextAddArcToPoint(context, maxX, maxY, midX, maxY, radius)
CGContextAddArcToPoint(context, minX, maxY, minX, midY, radius)
CGContextClosePath(context)
CGContextDrawPath(context, kCGPathFillStroke)
I don't understand what the problem is. What I am trying to do is create a rectangle with rounded corners in Swift. Why am I getting this error and is there a much easier way to do this?