How to make the upper corner edges rounded for UIView

i did something like this

Code Block
extension UIView {
  @IBInspectable var cornerRadius: CGFloat {
    get {
      return layer.cornerRadius
    }
    set {
      layer.cornerRadius = newValue
      layer.masksToBounds = newValue > 0
    }
  }
}


And added the corner radius under

Keypath | Type | Value
layer.cornerRadius | Number | 15

but the question is i want the rounded edges only on the top. Any idea how to implement it..?
Do you want ONLY upper corners rounded ?
If so, should create a BezierPath for drawing it.

I answered similar question here : https://stackoverflow.com/questions/63140607/how-can-i-achieve-this-rounded-view-in-swift?noredirect=1#comment111654718_63140607
How to make the upper corner edges rounded for UIView
 
 
Q