title: Share PDF from NSData via Share Sheet
body: <p>The PDF file is generated on a web server and received as NSData. Swift is able to print this NSData object; however, it is not recognized on the share sheet by other applications that usually accept PDFs, like Google Drive. The only options shown on the share sheet are for printing and copying.</p>
  
  <p>I have tried the following to no avail:</p>
  
  <pre><code>let dataProvider = CGDataProviderCreateWithCFData(pdfObject)
  let pdf = CGPDFDocumentCreateWithProvider(dataProvider)
  return pdf!
  </code></pre>
  
  <p>Per sbarow's comment, I have also tried the following, but the <code>retrievePDFFromDisk</code> function returns nil:</p>
  
  <pre><code>func writePDFToDisk () {
      var docURL = (NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)).last! as NSURL
      docURL = docURL.URLByAppendingPathComponent( "myDocument.pdf")
      pdfObject.writeToURL(docURL, atomically: true)
  }
  
  func retrievePDFFromDisk () -&gt; AnyObject {
      let pdf = NSBundle.mainBundle().URLForResource("myDocument", withExtension: "pdf")
      return pdf!
  }
  </code></pre>
  
  <p>How can this data be properly advertised as a PDF to other applications from the share sheet?</p>