Fast and optimized PDF viewing on iOS: tips and recommendations
Hello everyone! I'm developing a PDF reading app on iOS and have encountered performance issues. I'm using the standard `PDFView` from PDFKit, but when opening large PDF files (100+ pages with images), the app lags significantly, especially during scrolling and zooming. Memory grows uncontrollably, and animations become choppy.
Here's my current code:
```swift
import PDFKit
class PDFReaderViewController: UIViewController {
let pdfView = PDFView()
override func viewDidLoad() {
super.viewDidLoad()
pdfView.frame = view.bounds
pdfView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
view.addSubview(pdfView)
if let url = Bundle.main.url(forResource: "large_document", withExtension: "pdf") {
```