override func viewDidLoad() {
    super.viewDidLoad()

    //グラデーションの開始色
    let topColor = UIColor(red:147, green:6, blue:229, alpha:1)
    //グラデーションの開始色
    let bottomColor = UIColor(red:23, green:232, blue:252, alpha:1)

    let gradientLayer = CAGradientLayer()
    gradientLayer.frame = view.frame
    gradientLayer.colors = [topColor.cgColor, bottomColor.cgColor]
    gradientLayer.locations = [0.0, 1.0]
    gradientLayer.startPoint = CGPoint(x: 0.0, y: 1.0)
    gradientLayer.endPoint = CGPoint(x: 1.0, y: 1.0)
    gradientLayer.cornerRadius = 20.0

    self.view.layer.insertSublayer(gradientLayer, at: 0)

}

画像の説明をここに入力
view