I am able to successfully view a PDF from a website. I want to be able to download that PDF to the device, then access that file locally.
When the app is opened, it
With Swift version 3.0 syntax:
let url = NSURL(fileURLWithPath: "http://example.com/examplePDF.pdf")
if let pdfData = NSData(contentsOf: url as URL) {
let resourceDocPath = NSHomeDirectory().appending("/Documents/yourPDF.pdf")
unlink(resourceDocPath)
pdfData.write(toFile: resourceDocPath, atomically: true)
}