PDFKit - Pages turn black

I am making an app to display magazines as PDFs. Sometimes whilst viewing the PDF (usually after scrolling and zooming around), certain pages will turn black. I have linked a screenshot of this problem.


The black pages return to normal after I reload the page or execute


webView.transform = CGAffineTransform(rotationAngle: 0)
webView.frame = view.safeAreaLayoutGuide.layoutFrame


What's causing this and how can I prevent it?

Replies

I assume it's because the page is not yet loaded when you scroll rapidly

Thanks for the suggestion but that is not the case. Pages that turn black have already loaded and may have already been loaded for some time. Sometimes even the page that is currently in view turns black. Also, one page turning black often triggers many of the other pages to turn black.