iosios-pdfkitapple-pdfkit

How should be defined the options dictionary for PDFView usePageViewController withViewOptions:


How should be defined a dictionary of options for a pageViewController for a PDFView from PDFKit?

I am interested particulari with this flag

UIPageViewController.NavigationOrientation.horizontal

let pdfv = PDFView.init(frame: self.view.frame)

let opt = ?????

pdfv.usePageViewController(true, withViewOptions: opt)

Solution

  • The ViewOptions contains only 2 options: interPageSpacing and spineLocation: https://developer.apple.com/documentation/uikit/uipageviewcontroller/optionskey

    Exemple: pdfv.usePageViewController(true, withViewOptions: ["interPageSpacing": 50])

    If you want to change the pageViewController direction to horizontal, use this code:

    pdfv.displayDirection = .horizontal
    

    Hope this helps.