Create PDFViewController with Initializer Injection
Once the URL
property was injected into PDFViewController, it’s going to be immutable. This is why I choose Initializer Injection over Property Injection and Method Injection.
The only property injected is pdfUrl
, and the other properties, document
and outline
, which is accessible in the local class scope, can be set up during init()
.
Contents presented in pdfView
is determined by document
property. Since it never changes, I’ll also assign it doing init()
.
Set up horizontal paging
Now we have content which was defined in pdfView.document
. To make it horizontally scroll like a book, add some settings to PDFView.