title: Download pdf from base64 url webview swift
body: <p>I am trying to download a pdf from a url in a webview to the device. here is what the base64 endpoint looks like <code>data:application/pdf;base64,JVBERi0xLjMKJf////8KOCAwIG9iago8PAovVHlwZSAvRXh0R1N0YXRlCi9jYSAxCj4+CmVuZG9iagoxMiAwIG9iago8 ... JSVFT0YK</code></p>
  <p>Problem now is getting the data and downloading to show Activity view controller</p>
  <pre><code>private func downloadData(from url: URL, fileName: String, completion: @escaping (Bool, URL?) -&gt; Void) {
          webView.configuration.websiteDataStore.httpCookieStore.getAllCookies() { cookies in
              let session = URLSession.shared
              session.configuration.httpCookieStorage?.setCookies(cookies, for: url, mainDocumentURL: nil)
              let task = session.downloadTask(with: url) { localURL, urlResponse, error in
                  if let localURL = localURL {
  
                      let destinationURL = self.moveDownloadedFile(url: localURL, fileName: fileName)
                      completion(true, destinationURL)
                  }
                  else {
                      completion(false, nil)
                  }
              }
  
              task.resume()
          }
      }
  </code></pre>
  <p>in the navigationResponse I have this but the my break point is not triggered.</p>
  <pre><code>if let data = Data(base64Encoded: url.absoluteString, options: .ignoreUnknownCharacters) {
                          print(&quot;THE MINETYPE data: \(data)&quot;)
                      } 
  </code></pre>