How do I select or deselect an annotation programmatically?
You can select an annotation on the PSPDFPageView either by using select(annotations:presentmenu:animated:) to select a specific annotation, or by using selectedAnnotations, which can be set to an array of annotations that lets you select multiple annotations at once:
// Get the current page view. It's usually the first in the array.let pageView = pdfController.visiblePageViews[0]// Select an annotation.pageView.select(annotations: [inkAnnotation], presentMenu: false, animated: false)// Select multiple annotations.pageView.selectedAnnotations = [firstAnnotation, secondAnnotation];To deselect all currently selected annotations, set selectedAnnotations to an empty array, like this:
pageView.selectedAnnotations = []