I want to apply some round corners to the bottom and top left of a view inside a table cell. And I made this extension on UIView:
extension UIView {
func round(_ corners: UIRectCorner, radius: CGFloat) {
let path = UIBezierPath(roundedRect: bounds, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
let mask = CAShapeLayer()
mask.path = path.cgPath
self.layer.mask = mask
}
}
But I am not sure where exactly to call this on my view to display it correctly. Right now I have it called in layoutSubviews() of my custom cell, but the bottom left part is not round when I start my app, only after the cell goes out of the screen and gets redrawn.
What should be a good place to set the round corners inside a UITableViewCell ?
edit:
Here is the screenshot with the hierarchy:

Code:
override func layoutSubviews() {
super.layoutSubviews()
configureView()
}
func configureView() {
bgView.layer.cornerRadius = 3.0
period.round([.bottomLeft, .topLeft], radius: 3.0)
bgView.layer.masksToBounds = false
period.layer.masksToBounds = false
bgView.layer.shadowColor = UIColor.black.withAlphaComponent(0.2).cgColor
bgView.layer.shadowOffset = CGSize(width: 0, height: 0)
bgView.layer.shadowOpacity = 0.8
}
edit 2:


