I want to draw the differences between 2 UIBezierPath (see screenshot) to only draw rounded corners, as you can see in my screenshot (Figure C)

Here is my code:
let context = UIGraphicsGetCurrentContext()
CGContextSaveGState(context)
let rectanglePath = UIBezierPath(rect: rect)
CGContextAddPath(context, rectanglePath.CGPath)
CGContextEOClip(context)
let roundedRectanglePath = UIBezierPath(roundedRect: productRect, byRoundingCorners: roundedCorners, cornerRadii: CGSize(width: 6, height: 6))
CGContextAddPath(context, roundedRectanglePath.CGPath)
CGContextFillPath(context)
CGContextRestoreGState(context)
Unfortunately this will not work. I draw only a rounded black rectangle.
Do you have an idea?
Many thanks.
source
share