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
I found a swift version for it:
let url = "http://example.com/examplePDF.pdf"
if let pdfData = NSData(contentsOfURL: url) {
let resourceDocPath = NSHomeDirectory().stringByAppendingString("/Documents/yourPDF.pdf")
unlink(resourceDocPath)
pdfData.writeToFile(resourceDocPath, atomically: true)
}
Just remember to save the path file and you'll be able to fetch it whenever you need it.