How to remove some part of my Path? I have a path drawn in my screen, and now lets say I would like to remove 1/3:

I tried to do it in this way(path is my original path, cPath is copy which will be clipped):
let sizePath = CGPathGetBoundingBox(path).size
UIGraphicsBeginImageContext(sizePath)
let context = UIGraphicsGetCurrentContext()
let cPath = CGPathCreateMutableCopy(path)
CGContextAddPath(context, cPath)
CGContextDrawPath(context, .Stroke)
let rect = CGRectMake(currentPosition.x, 0, sizePath.width, sizePath.height)
CGContextClipToRect(context, rect)
//How to Recive here this Clipped Path from context???
UIGraphicsEndImageContext()
But I don't know how to receive this path from my context...
You need to CGContextClipToRect before you CGContextDrawPath. The clip region only affects subsequent drawing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With