Draw ellipse gradient in Swift

Viewed 194

I want to draw ellipse gradient in Swift.

In CSS:

background: radial-gradient(50% 25% at 20% 30%, #ffffff, #ff0000);

I expect appearance to be like following:

enter image description here

I know I can draw circle gradient by using CGContext.drawRadialGradient(_:startCenter:startRadius:endCenter:endRadius:options). But, I don't know how to draw ellipse gradient.

Any idea? Thanks in advance.

0 Answers
Related