···
let maskLayer = CAShapeLayer();
maskLayer.frame = icon.bounds;
maskLayer.path = UIBezierPath(
roundedRect: view.bounds,
byRoundingCorners: [.BottomLeft, .BottomRight],
cornerRadii: CGSize(width: cornerRadius, height: cornerRadius)
).CGPath
maskLayer.masksToBounds = false;
someView.layer.mask = maskLayer;
···
參考:https://littlebitesofcocoa.com/211-rounding-corners-with-uirectcorner-and-uibezierpath