mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
24 lines
597 B
Swift
24 lines
597 B
Swift
//
|
|
// 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) {
|
|
notImplemented()
|
|
}
|
|
|
|
public override func layoutSubviews() {
|
|
super.layoutSubviews()
|
|
gradientLayer.frame = self.bounds
|
|
}
|
|
}
|