不说废话,线上效果和调用
效果:实现随意View对象实例的简单创建、去除、修改渐变色
import UIKit
class TestViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
configure()
}
private func configure() {
_ = view
.gradientSize(CGSize(width: screenWidth, height: screenHeight))
.gradientColors([E_Color.THEME_COLOR_1, E_Color.THEME_COLOR_2, E_Color.THEME_COLOR_3,E_Color.THEME_COLOR_4, E_Color.THEME_COLOR_5])
.gradientLocations([0, 0.25, 0.5, 0.75, 1.0])
.gradientStart(CGPoint(x: 0, y