First of all the parameters red
,green
, blue
and alpha
must be in range from 0.0 to 1.0
Secondly, you must pass the cgColor
to CGLayer
, e.g.
let color = UIColor(red: 57.0/255.0, green: 65.0/255.0, blue: 101.0/255.0, alpha: 1)
shapeLayer.fillColor = color.cgColor
shapeLayer.strokeColor = color.cgColor
solved Using UIColor with CAShapeLayer