Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func applyGradient(colours: [UIColor]) -> Void {
- let gradient: CAGradientLayer = CAGradientLayer()
- gradient.frame = self.bounds
- gradient.colors = colours.map { $0.cgColor }
- self.layer.insertSublayer(gradient, at: 0)
- }
- func applyGradientToView(){
- let firstColor = UIColor(red: 26/255, green: 169/255, blue: 186/255, alpha: 1.0)
- let secondColor = UIColor(red: 26/255, green: 97/255, blue: 157/255, alpha: 1.0)
- let thirdColor = UIColor(red: 27/255, green: 65/255, blue: 144/255, alpha: 1.0)
- self.applyGradient(colours: [firstColor, secondColor, thirdColor])
- }
Add Comment
Please, Sign In to add comment