```
import UIKit

class MainVC: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        }
    func backgroundcolor(){
        let newLayer = CAGradientLayer()
                    newLayer.colors = [UIColor.init(red: 0.2705882353, green: 0.4823529412, blue: 0.6156862745, alpha: 1).cgColor,UIColor.init(red: 0.6588235294, green: 0.8549019608, blue: 0.862745098, alpha: 1).cgColor]
                    newLayer.frame = view.frame
                    view.layer.addSublayer(newLayer)
    }
}

```