How to show PDF from NSData in Swift - how to save PDF to documents folder Swift - how to display PDF from saved NSData via WebView in Swift
<p>I have a PDF that I'm pulling from a sever that came in the form of NSData and now I need to display it. I've looked far and wide for a solution to this and I haven't found anything that bridges the gap between raw NSData and actually saving or showing the PDF. </p>

<p>I tried this but now I'm stuck not knowing how to save or show:</p>

<pre><code>let cfData = CFDataCreate(kCFAllocatorDefault, UnsafePointer&lt;UInt8&gt;(data.bytes), data.length)                                                
let cgDataProvider = CGDataProviderCreateWithCFData(cfData)
let cgPDFDocument = CGPDFDocumentCreateWithProvider(cgDataProvider)
</code></pre>