UIGraphicsGetCurrentContext() should either throws or be optional. It isn’t. It’s func UIGraphicsGetCurrentContext() -> CGContext.
So right now when I either try or if let, I can’t. I can’t even if context == nil, which means I have a lot of code I need to annotate with TODO and hope that I remember to come back to it.
For now, I’m just assuming the value returned is valid:
/// Perform a drawing transaction without /// affecting general graphics state public func PushDraw(block: () -> Void) { let context = UIGraphicsGetCurrentContext() CGContextSaveGState(context) block() CGContextRestoreGState(context) }
21494444
Comments are closed.