I know I can round all four corners using:
myBtn.layer.cornerRadius = 8 myBtn.layer.masksToBounds = true
Since I only want to round two,
You forgot to set the frame of your shape layer:
mask.frame = layer.bounds