Skip to content

Instantly share code, notes, and snippets.

@josevazquez
Created October 13, 2016 03:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josevazquez/36fb0aea593c4f3c7915c1a3ac99d26e to your computer and use it in GitHub Desktop.
Save josevazquez/36fb0aea593c4f3c7915c1a3ac99d26e to your computer and use it in GitHub Desktop.
Plain CoreGraphics calls in Swift
guard let ctxt = UIGraphicsGetCurrentContext() else {
print("BAILING OUT WITHOUT A GRAPHICS CONTEXT !!")
return
}
ctxt.setStrokeColor(gray:0, alpha:kKnobOpacity)
ctxt.setLineWidth(knobThickness)
ctxt.addEllipse(in:rect)
ctxt.strokePath()
ctxt.saveGState()
ctxt.setBlendMode(.copy)
ctxt.setStrokeColor(gray:0, alpha:0)
ctxt.setFillColor(gray:0, alpha:0)
fillCurvedDoubleArrow(ctxt:ctxt, center:boundsCenter, radius:innerRadius, thickness:knobThickness*0.2, angle:270, aperture:25)
ctxt.restoreGState()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment