It would be great if the video mentioned why startAngle is Pi and endAngle is 0 (because of the coordinate system iOS uses?).
@chenglu - great comment.
The default coordinate system is based on an upside down standard unit circle.
Here’s the standard unit circle:
And here’s Apple’s unit circle:
When we specify clockwise in the arc’s function call, we go in a clockwise direction, so 90 degrees (or π / 2) is at the bottom.
In the video I went clockwise from π to 0. But equally I could have gone anti-clockwise from 0 to π.
I had two questions I was hoping to get help with:
I noticed in the second curve you add to the point, the line width is multiplied by two, whereas the previous curve used the line width by itself. Is there a reason to this that I am missing?
Secondly, is there a reason we are using CAShapeLayer vs just drawing over whatever was previously drawn in Core Graphics?