The main idea of this converter is adopt the same gradient from Web to iOS. The CSS has linear-gradient() func to create gradient.
background: linear-gradient(-275DEG, red, yellow);
background: linear-gradient(35deg, red, yellow);
background: linear-gradient(680deg, red, yellow);
Unlike UIKit has another coordinate subsystem for CGGradientLayer:
gradientLayer.startPoint = CGPoint(x:0, y:0.559)
gradientLayer.endPoint = CGPoint(x:1, y:0.441)
// and so on
let size = CGSize(width: 200, height: 100)
let gradient = CAGradientLayer()
gradient.frame = CGRect(x: 0, y: 0, width: size.width, height: size.height)
gradient.colors = [UIColor.red.cgColor, UIColor.yellow.cgColor]
let points = gradientPoints(size: gradient.bounds.size, cssAngle: -275)
gradient.startPoint = points.start
gradient.endPoint = points.end
CSSGradientToUIKit is released under the MIT License.