I know I can round all four corners using:
myBtn.layer.cornerRadius = 8 myBtn.layer.masksToBounds = true
Since I only want to round two,
iOS 11 has made it really easy to round corners. The code below rounds the top left and bottom right corners.
myView.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMaxYCorner]