If someone is still looking for a solution, Apple has finally introduced the .conic gradient type in iOS 12. Ideal for .conic to mask to create a circular .conic bar with a gradient.
Example:
let gradientLayer = CAGradientLayer() gradientLayer.startPoint = CGPoint(x: 0.5, y: 0.5) gradientLayer.endPoint = CGPoint(x: 0.5, y: 0) gradientLayer.type = .conic gradientLayer.colors = [UIColor.red.cgColor, UIColor.orange.cgColor, UIColor.green.cgColor] gradientLayer.frame = bounds

Michał Kwiecień
source share