I want to add a table with a solid border with rounded corners:
.
I have tried using a CALayer, which can be called making the cell and adds rounded corners:
let maskLayer = CALayer() maskLayer.cornerRadius = 10 //if you want round edges maskLayer.backgroundColor = UIColor.white.cgColor maskLayer.borderColor = UIColor.red.cgColor maskLayer.borderWidth = 5 self.layer.borderColor = UIColor.red.cgColor // no change self.layer.borderWidth = 5 // no change maskLayer.frame = CGRect(x: self.bounds.origin.x, y: self.bounds.origin.y, width: self.bounds.width, height: self.bounds.height).insetBy(dx: horizontalPadding/2, dy: verticalPadding/2) self.layer.mask = maskLayer I have tried adding borders, but the rounded corners look very messy. How would I add rounded corners and a solid border?
I have looked at this question which talks about changing border colours, but it does not give the cells a rounded border like in the image above. Only the top and bottom have a rounded border.
self.layer.addSublayer(maskLayer)