title: Download .pdf or .ppt by WebView in Swift
body: <p>I'm using the "webview" component to access the website. In an undetermined part of site, we have .pdf and .ppt format files.
  Can I download these files when the user clicks on them? Today, the application only opens .pdf and .ppt, but I would like to download it.</p>
  
  <p>My code is in pt_BR.</p>
  
  <pre><code>class PortalAcademicoViewController: UIViewController {
  
  
      @IBOutlet weak var webView: UIWebView!
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          carregaSite()
  
      }
  
  
      func carregaSite(){
          /*
          let url = URL(string: "")
          var urlRequest = URLRequest(url: url!)
          urlRequest.cachePolicy = .returnCacheDataElseLoad
          webView.loadRequest(urlRequest) */
  
  
          //carregar o arquivo html
          let htmlFile = Bundle.main.path(forResource: "portalacademico", ofType: "html")
          let html = try? String(contentsOfFile: htmlFile!, encoding: String.Encoding.utf8)
          HTTPCookieStorage.shared.cookieAcceptPolicy = .always
          self.webView.frame = self.view.bounds
          webView.loadHTMLString(html!, baseURL: Bundle.main.resourceURL)
  
          //voltar e avançar entres as paginas do webview
          let swipeLeftRecognizer = UISwipeGestureRecognizer(target: self, action: #selector(handleSwipe(recognizer:)))
          let swipeRightRecognizer = UISwipeGestureRecognizer(target: self, action: #selector(handleSwipe(recognizer:)))
  
          swipeLeftRecognizer.direction = .left
          swipeRightRecognizer.direction = .right
  
          webView.addGestureRecognizer(swipeLeftRecognizer)
          webView.addGestureRecognizer(swipeRightRecognizer)
          //fim
  
      }
  
  
  
      //trabalhando com avançar e voltar webview
      @objc private func handleSwipe(recognizer: UISwipeGestureRecognizer) {
          if (recognizer.direction == .left) {
              if webView.canGoForward {
                  webView.goForward()
              }
          }
  
          if (recognizer.direction == .right) {
              if webView.canGoBack {
                  webView.goBack()
              }
          }
      }
      //FIM
  
  }
  </code></pre>