I'm a beginning programmer in Swift, and I'm attempting to draw an ellipse in swift with a rainbow gradient that fills it, similar to a color wheel.
I'm confused as to how to approach this. I'm currently drawing the ellipse:
let context: CGContext = UIGraphicsGetCurrentContext()!
context.setFillColor()
context.addEllipse(in: Rectangle)
context.drawPath(using: .fill)
But instead of setting the fill color, I want to draw a rainbow gradient inside it.
I've looked at this gradient method:
context.drawLinearGradient()
But I'm not sure how to go about it. If someone could point me in the right direction, I'd appreciate it. Thanks!