session-ios/SignalMessaging/Views/GradientView.swift

25 lines
597 B
Swift
Raw Normal View History

2018-03-20 22:29:35 +01:00
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
public class GradientView: UIView {
let gradientLayer = CAGradientLayer()
public required init(from fromColor: UIColor, to toColor: UIColor) {
gradientLayer.colors = [fromColor.cgColor, toColor.cgColor]
super.init(frame: CGRect.zero)
self.layer.addSublayer(gradientLayer)
}
public required init?(coder aDecoder: NSCoder) {
2018-08-27 16:21:03 +02:00
notImplemented()
2018-03-20 22:29:35 +01:00
}
public override func layoutSubviews() {
super.layoutSubviews()
gradientLayer.frame = self.bounds
}
}