Post

Replies

Boosts

Views

Activity

Codes are not working at this video.
https://developer.apple.com/videos/play/wwdc2022/10089/ I am trying to run codes about PDFPageOverlayViewProvider, but the codes are not working. I cannot see what I wrote or annotate. Anyone know how can I solve and make this code working?  func pdfView(_ view: PDFView, overlayViewFor page: PDFPage) -> UIView? {         var resultView: PKCanvasView? = nil         if let overlayView = pageToViewMapping[page] {             resultView = (overlayView as! PKCanvasView)         } else {             let canvasView = PKCanvasView(frame: .zero)             canvasView.drawingPolicy = .anyInput             canvasView.tool = PKInkingTool(.pen, color: .yellow, width: 20)             canvasView.backgroundColor = .clear             pageToViewMapping[page] = canvasView             resultView = canvasView         }         let page = page as! WatermarkPage         if let drawing = page.drawing {             resultView?.drawing = drawing         }         return resultView     }          func pdfView(_ pdfView: PDFView, willEndDisplayingOverlayView overlayView: UIView, for page: PDFPage) {         let overlayView = overlayView as! PKCanvasView         let page = page as! WatermarkPage         page.drawing = overlayView.drawing         pageToViewMapping.removeValue(forKey: page)     }
2
0
1k
Feb ’23