Skip to content

Instantly share code, notes, and snippets.

@sjehutch
Last active January 4, 2018 19:41
Show Gist options
  • Save sjehutch/1e261ebda964f981ed602d7b3e29e800 to your computer and use it in GitHub Desktop.
Save sjehutch/1e261ebda964f981ed602d7b3e29e800 to your computer and use it in GitHub Desktop.
GradientBackgroundView-Class
import Foundation
import UIKit
class GradientView: UIView {
override open class var layerClass: AnyClass {
return CAGradientLayer.classForCoder()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
let gradientLayer = self.layer as! CAGradientLayer
gradientLayer.colors = [UIColor.white.cgColor, UIColor.black.cgColor]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment