Im working on an application that needs to display a pretty large PDF file. I'm using PDFKits PDFView for this, which is then wrapped in a UIViewRepresentable. The problem is that when setting PDFView.autoScales = true
i get an error on startup. The application still works and so does the autoScales feature but I would still like to fix the error. I should also mention that I'm a complete beginner when it comes to iOS development.
This is my implementation of makeUIView:
func makeUIView(context: UIViewRepresentableContext<PDFKitRepresentedView>) -> PDFKitRepresentedView.UIViewType {
let pdfView = PDFView()
pdfView.autoScales = true
pdfView.pageBreakMargins.top = 0.0
pdfView.pageBreakMargins.bottom = 0.0
pdfView.pageShadowsEnabled = false
pdfView.document = PDFDocument(url: self.url)
return pdfView
}
And this is the error:
[Assert] -[UIScrollView _clampedZoomScale:allowRubberbanding:]: Must be called with non-zero scale
[Unknown process name] CGAffineTransformInvert: singular matrix.
They seem to get printed whenever the PDFView gets initialized. Any ideas what the problem could be?