Now we'll replace the solid orange color with a gradient, but this time, a gradient that faces the other way:
- Delete the following lines of code from the drawMinutes method:
darkColor.setFill() path.fill()
This time, instead of initiating an NSGradient as we did for the clock face, we will draw into the graphics context, using CGGradient. The Core Graphics methods that we use to do that work a little differently to AppKit's methods, as we'll see shortly.
To begin with, we need to specify three values with which to configure the CGGradient object. We'll go through these one at a time.
Firstly, we need to define a CGColorSpace, which will inform Core Graphics that we are using RGB colors.
- Add the following ...