I am trying to add border each UIView. The first and the last selected dates should have rounded corners but the masking applied by the rounded corners extension is cropping it out.
I have tried many other solutions but this one seems to be the closest to be true.
Excuse my bad english.
extension FSCalendarCell {
func changeCellStyle(isSelected:Bool, firstIndex:Bool, lastIndex:Bool, color:UIColor){
let v = UIView(frame: CGRect(x: 0,y: 0,width: self.bounds.width,height: self.bounds.height))
v.center = self.contentView.center
v.backgroundColor = UIColor.red
if firstIndex {
v.addBorder(edges: [.top,.bottom,.left], color: UIColor.blue, thickness: 2)
v.roundCorners([.topLeft, .bottomLeft], radius: 10)
}else if lastIndex {
v.addBorder(edges: [.top,.bottom,.right], color: UIColor.blue, thickness: 2)
v.roundCorners([.topRight, .bottomRight], radius: 10)
}else{
v.addBorder(edges: [.top,.bottom], color: UIColor.blue, thickness: 2)
}
self.contentView.insertSubview(v, at: 0)
}
}