title: PDFView causes app to freeze on iOS 16, only when autoscales = true
body: <p>I am using a PDFView to display images in my app (built using SwifUI), simply for quick and easy pinch-to-zoom functionality. This worked perfectly in iOS 15, but since updating to iOS 16, the app freezes when attempting to load the image viewer (<code>PhotoDetailView</code> below). The issue persists across both the simulator and a physical device.</p>
  <p>Here is the code I'm using:</p>
  <pre><code>import SwiftUI
  import PDFKit
  
  struct PhotoDetailView: UIViewRepresentable {
      let image: UIImage
  
      func makeUIView(context: Context) -&gt; PDFView {
          let view = PDFView()
          view.document = PDFDocument()
          guard let page = PDFPage(image: image) else { return view }
          view.document?.insert(page, at: 0)
          view.autoScales = true
          return view
      }
  
      func updateUIView(_ uiView: PDFView, context: Context) {
          // empty
      }
  }
  </code></pre>
  <p>When I run the code on iOS 16.0 in the simulator, I get 2 errors in the console:</p>
  <ol>
  <li><code>[Assert] -[UIScrollView _clampedZoomScale:allowRubberbanding:]: Must be called with non-zero scale</code></li>
  <li><code>[Unknown process name] CGAffineTransformInvert: singular matrix.</code></li>
  </ol>
  <p>I have been able to isolate the issue to <code>view.autoscales = true</code>. If I print <code>view.scaleFactor</code>, I can see that it is <strong>1.0</strong> before the autoscale and <strong>0.0</strong> afterward (which is what appears to be prompting the errors). These errors also show up in the console when using iOS 15 in the simulator, but the images load as expected.</p>
  <p>When <code>view.autoscales = true</code> is commented out, the image loads, albeit at a size that is much larger than the device screen.</p>
  <p>Does anyone have any idea what may be causing this? I'd really like to avoid having to build a custom viewer, since I'm just trying to let users quickly pinch to zoom on images.</p>