그라디언트 뷰를 따로 만들어서 사용하는 방법 class GradientView: UIView { private let gradientLayer = CAGradientLayer() override init(frame: CGRect) { super.init(frame: frame) setGradientLayer() } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } private func setGradientLayer() { gradientLayer.frame = bounds gradientLayer.colors = [UIColor.blue.cgColor, UIColor.red.cgColor] grad..