I have this code to modify the colors from the interface :
@IBDesignable
class GradientView: UIView {
@IBInspectable var firstColor: UIColor = UIColor.clear{
didSet{
updateView()
}
}
@IBInspectable var secondColor: UIColor = UIColor.clear{
didSet{
updateView()
}
}
override class var layerClass: AnyClass{
get{
return CAGradientLayer.self
}
}
func updateView(){
let layer = self.layer as! CAGradientLayer
layer.colors = [ firstColor.cgColor, secondColor.cgColor ]
layer.locations = [ 0.5 ]
}
}
How can I add here to modify the angle?