To stroke a CG path, which should I use?
CGContextStrokePath(context)
or
CGContextDrawPath(context, .Stroke)
What's the difference between the two?
Stroking a path draws the outline of the path using the current settings. Always a stroke, never a fill.
CGContextDrawPath
draws the path using the specified mode. If you pass in a mode of kCGPathStroke
, it does the same thing as CGContextStrokePath
Likewise, if you call CGContextDrawPath
with a mode of kCGPathFill
, it does the same thing as CGContextFillPath
If you only want to stroke, not fill a path, then use CGContextStrokePath
.