CGContextSetLineCap
CGContextSetLineCap is a function in the Core Graphics framework used in Apple's operating systems to control the shape of the endpoints of lines drawn within a graphics context. This function takes two arguments: the graphics context to modify and a constant specifying the line cap style. The line cap style determines how the ends of a line segment are rendered. There are three primary line cap styles defined by Core Graphics: kCGLineCapButt, kCGLineCapRound, and kCGLineCapSquare.
kCGLineCapButt, also known as a "butt cap," renders the line with square ends that are perpendicular to
By setting the line cap style before drawing a line, developers can precisely control the aesthetic appearance