I used the below code to draw a line to a pdfpage. Is there any way i can erase the annotation like an eraser when user drags over it.
let lineAttributes: [PDFAnnotationKey: Any] = [ .linePoints: [startPoint.x, startPoint.y, point.x, point.y],
.lineEndingStyles: [PDFAnnotationLineEndingStyle.none,PDFAnnotationLineEndingStyle.none], .color: UIColor.red,.border: PDFBorder() ]
let lineAnnotation = PDFAnnotation(bounds: pageBounds , forType: .line,withProperties: lineAttributes)
lineAnnotation.border = border
lineAnnotation.color = selectedcolor
page!.addAnnotation(lineAnnotation)
1) add pan gesture recognizer to your PDFView
2) keep track of the gesture and in the right moment (like the gesture goes over the annotation) call
page.removeAnnotation(lineAnnotation)
this is how you can get the touch location inside the page from the gesture recognizer