// // PDFViewController.swift // GME Remit // // Created by InKwon James Kim on 2019/12/23. // Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved. // import UIKit import PDFKit struct PDFConfiguration { var title: String var url: String var autoScales = true var displayMode: PDFDisplayMode = .singlePageContinuous } class PDFViewController: UIViewController { @IBOutlet private weak var pdfView: PDFView! private var configure = PDFConfiguration( title: "PDF TITLE", url: "" ) override func viewDidLoad() { super.viewDidLoad() } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) title = configure.title setupNormalNavigation() guard let url = URL(string: configure.url) else { return } let document = PDFDocument(url: url) pdfView.document = document pdfView.autoScales = configure.autoScales pdfView.displayMode = configure.displayMode } func showAsPush( _ target: UIViewController, configure: PDFConfiguration ) { self.configure = configure target.navigationController?.pushViewController(self, animated: true) } }