I want to know if there is any way for a offline build for xcode iOS such that we can display pdf file from local file.
The method I\'m using now is vi
we are iOS coders, no JS/Web programmer, so stay in swift and Apple APIs. The faster, cleaner, way is to use Quicklook.
I quote calimarkus.
Anyway code is very simple:
// Copyright © 2019 ing.conti. All rights reserved.
//
import UIKit
import QuickLook
class ViewController: UIViewController, QLPreviewControllerDataSource {
var previewController:QLPreviewController?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.previewController = QLPreviewController()
previewController!.dataSource = self
present(previewController!, animated: true)
}
//QL delegate:
func numberOfPreviewItems(in controller: QLPreviewController) -> Int {
return 1
}
func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
guard let url = Bundle.main.url(forResource: "SAMPLE", withExtension: "pdf") else {
fatalError("Could not load pdf")
}
return url as QLPreviewItem
}
}