Here is what I am trying to do:

The screenshot is taken from Iphone:

This is my code:
import UIKit
class GradientController: UIViewController {
@IBOutlet weak var viewBottomBorder: UIView!
lazy var gradient: CAGradientLayer = {
let gradient = CAGradientLayer()
gradient.type = .axial
gradient.colors = [UIColor.clear.cgColor,UIColor.black.cgColor]
gradient.locations = [0, 1]
return gradient
}()
override func viewDidLoad() {
super.viewDidLoad()
gradient.frame = view.bounds
viewBottomBorder.layer.addSublayer(gradient)
}
}
Question: How to show same bottom gradient colour the view?
Can someone please explain to me how to solve this , i’ve tried to solve this issue but no results yet.
Any help would be greatly appreciated.
Thanks in advance.




