import QuickLook
func openQlPreview()
{
let previoew = QLPreviewController.init()
previoew.dataSource = self
previoew.delegate = self
self.present(previoew, animated: true, completion: nil)
}
extension UIViewController : QLPreviewControllerDelegate , QLPreviewControllerDataSource
{
func numberOfPreviewItems(in controller: QLPreviewController) -> Int
{
return 1
}
func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem
{
// pass your document url here
return path as QLPreviewItem
}
func previewController(_ controller: QLPreviewController, shouldOpen url: URL, for item: QLPreviewItem) -> Bool
{
return true
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.