title: data from base64 url
body: <p>I have a URL in the form of</p>
  
  <p><code>foo://?data:application/x-foo;base64,OjAyMDAwMDA0MDAwMEZBDQo6MTAwMDA...</code></p>
  
  <p>and now need to extract the base64 data into a <code>Data</code> object.</p>
  
  <p>Unfortunately it seems the <code>Data</code> object does not support this yet as</p>
  
  <p><code>let data = try Data(contentsOf: url)
  </code></p>
  
  <p>returns <code>NSURLConnection finished with error - code -1002</code> when trying.</p>
  
  <p>While I could <a href="https://stackoverflow.com/questions/39206139/how-to-convert-base64-into-nsdata-in-swift">decode the URL manually</a> I am wondering if I am missing a simple standard way of doing this. How would you do this?</p>