Showing a PDF in SwiftUI
Let's create a new SwiftUI app in Xcode called
We then need a PDF document to present. We are providing an example in the repo https://github.com/PacktPublishing/SwiftUI-Cookbook/blob/master/Resources/Chapter13/recipe4/PDFBook.pdf, but feel free to use a PDF document of your choice.
With the PDF document in the project, we are ready to implement our PDF viewer in SwiftUI.
How to do it
PDFView class is a subclass of
UIView, it must be encapsulated in a