Last active
January 4, 2018 19:41
-
-
Save sjehutch/1e261ebda964f981ed602d7b3e29e800 to your computer and use it in GitHub Desktop.
GradientBackgroundView-Class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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