How Can I Block Annotation Editing and Deletion While Still Allowing for Annotation Manipulation?

To prevent the menu from being presented for selected annotations, implement the pdfViewController(_:menuForAnnotations:onPageView:appearance:suggestedMenu:) delegate method and return an empty UIMenu:

func pdfViewController(_ sender: PDFViewController, menuForAnnotations annotations: [Annotation], onPageView pageView: PDFPageView, appearance: EditMenuAppearance, suggestedMenu: UIMenu) -> UIMenu {
    UIMenu(children: [])
}

To prevent the selected annotations from being resized, override the allowResizing property of the ResizableView class and always return false from its getter:

class NotResizableView: ResizableView {
    override var allowResizing: Bool {
        get {
            false
        }
        set {
            // Do nothing.
        }
    }
}

Check out our overriding classes guide to learn more about the technique of subclassing PSPDFKit’s views.