Described in any file (I created an extension file for UI parts and described it there)
///A method to round a specified corner with a specified radius
///- Parameters:
/// -radius
/// -Specified corner
public func setCornerRadius(_ radius: CGFloat,_ corners: CACornerMask) {
layer.cornerRadius = radius
layer.masksToBounds = true
layer.maskedCorners = corners
}
///This time, all corners are rounded.
let corners = [.layerMaxXMinYCorner, .layerMinXMaxYCorner, .layerMinXMinYCorner, .layerMaxXMaxYCorner ]
view.setCornerRadius(15, corners)
that's all. I would appreciate it if you could refer to it.
Recommended Posts