Swift: círculo de colores del arco iris
Hola, estoy tratando de escribir un selector de color de forma rápida que se vea así.
Pero hasta ahora logré esto.
Dibujar círculo fue fácil, aquí está el código ...
fileprivate func setupScene(){
let circlePath: UIBezierPath = UIBezierPath(arcCenter: CGPoint(x: self.wheelView.frame.width/2, y: self.wheelView.frame.height/2), radius: CGFloat(self.wheelView.frame.height/2), startAngle: CGFloat(0), endAngle:CGFloat(Double.pi * 2), clockwise: true)
let shapeLayer = CAShapeLayer()
shapeLayer.path = circlePath.cgPath
//color inside circle
shapeLayer.fillColor = UIColor.clear.cgColor
//colored border of circle
shapeLayer.strokeColor = UIColor.purple.cgColor
//width size of border
shapeLayer.lineWidth = 10
wheelView.layer.addSublayer(shapeLayer)
}
@IBOutlet var wheelView: UIView!
Pero ahora no sé cómo insertar los colores del arco iris ... Probé CAGradientLayer pero no era visible. ¿Algún buen consejo?