title: Open file with quicklook(download from url)
body: <p>Now I want to open file(ex:.docx,.txt,.ppt,.png) with quicklook, I download two files from my own server,I want to open the first file,but I'm not sure if there is a successful download, and I don't know how to use Quick Look Framework,and it say </p>
  
  <blockquote>
    <p>Type 'BdDeatilViewController' does not conform to protocol
    'QLPreviewControllerDataSource'</p>
  </blockquote>
  
  <p>,but I have added the protocol of QLPreviewControllerDataSource,can anyone help me with it?
  Here are my codes,thanks!  </p>
  
  <pre><code>class BdDeatilViewController:UIViewController,QLPreviewControllerDataSource
  {
  
  
      let quickLookController = QLPreviewController()
  
      var fileUrlArray:[String] = []
      var urlArray : [URL] = []
  
      override func viewDidLoad() {
          super.viewDidLoad()
          addUrlTofile(fileArray: bulletinBoard.attachments!)
          stringToUrl(stringArray: fileUrlArray)
  
          quickLookController.dataSource = self
      }
  
      @IBAction func openFile(_ sender: Any) {
  
          downloadFile(url: urlArray, atIndex: 0)
          quickLookController.currentPreviewItemIndex = 0
          navigationController?.pushViewController(quickLookController, animated: true)
  
      }
  
      //add profix url to file
      func addUrlTofile(fileArray:Array&lt;String&gt;)  {
          for file in fileArray {
              var newURL:String = ""
              newURL = "http://163.18.22.78:81/api/Donwload/" + file
              fileUrlArray.append(newURL)
          }
      }
  
      //convert string array to URL array
      func stringToUrl(stringArray:Array&lt;String&gt;) {
          for i in stringArray {
              let url = URL(string: i)
              urlArray.append(url!)
          }
      }
  
      //download file from server
      func downloadFile(url:[URL],atIndex:Int) {
  
          let requestURL = url[atIndex]
          let urlRequest: NSMutableURLRequest = NSMutableURLRequest(url: requestURL)
          let session = URLSession.shared
          let task = session.dataTask(with: urlRequest as URLRequest) {
              (data, response, error) -&gt; Void in
              if let httpResponse = response as? HTTPURLResponse {
                  let statusCode = httpResponse.statusCode
                  if (statusCode == 200) || ((statusCode == 204)) {
                     print("Everyone is fine, file downloaded successfully.")
                  }
              }
          }
          task.resume()
      }
  
      func numberOfPreviewItemsInPreviewController(controller: QLPreviewController) -&gt; Int {
          return urlArray.count
      }
  
      func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -&gt; QLPreviewItem {
          return urlArray[index] as QLPreviewItem
      }
  
  }
  </code></pre>