PDFKit Horizontal Scrolling

It seems that horizontal scrolling is broken in b3 of iOS 11. Here's my code:


  let pdfView = PDFView(frame: frame)
  pdfView.document = pdfDocument
  pdfView.autoScales = true
  pdfView.displayDirection = .horizontal
  pdfView.displayMode = .singlePage


When I display this view, I see just the first page of the document. I can scroll vertically (and, judging by the scroll bar thumb size, quite a bit), but not horizontally. Without doing too much investigation, it looks like perhaps the content size of the PDFView's scroll view is being set for vertical content, not horizontal. Is anyone else seeing this?


Thanks!


Ben

the

displayMode =.singlePageContinuous

allows for scrolling on the horizontal*


*though it doesnt zoom the pages to show one at a time like iBooks.

Im at a loss on how to do that so have posted a Q on this forum


if you set to

.singlePage


adding a GestureRecognizer will allow to change pages (showing a right to left swipe or backwards)

let swipeRight = UISwipeGestureRecognizer(target: self, action: #selector(self.respondToSwipeGesture))
        swipeRight.direction = UISwipeGestureRecognizerDirection.right


then handle it

@objc func respondToSwipeGesture(gesture: UIGestureRecognizer) {
        if let swipeGesture = gesture as? UISwipeGestureRecognizer {
            switch swipeGesture.direction {
            case UISwipeGestureRecognizerDirection.right:
                print("Swiped back")
                if pdfView.canGoToPreviousPage() {
                    pdfView.goToPreviousPage(nil)
                }
            default:
                break
            }
        }
    }


add left swipe using same method

PDFKit Horizontal Scrolling
 
 
Q