Created
April 27, 2019 13:25
-
-
Save laevandus/1bd79bb90116ca2e933dbbee6e7dd483 to your computer and use it in GitHub Desktop.
This file contains 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
private lazy var animatingView: UIView = { | |
let view = GradientView(frame: .zero) | |
view.gradientLayer.colors = (1...3).map({ "Gradient\($0)" }).map({ UIColor(named: $0)!.cgColor }) | |
view.translatesAutoresizingMaskIntoConstraints = false | |
return view | |
}() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
view.backgroundColor = .darkGray | |
view.addGestureRecognizer(gestureRecognizer) | |
view.addSubview(animatingView) | |
NSLayoutConstraint.activate([ | |
animatingView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 72), | |
animatingView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -72), | |
animatingView.topAnchor.constraint(equalTo: view.topAnchor, constant: 72), | |
animatingView.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -72) | |
]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment