Swift save PDF from URL

Can someone please provide source code that will allow me to save a PDF file to an iPhone. I have tried FileManager but it does not seem to work.

Replies

You need to be more specific about your requirements. Do you want to save the downloaded PDF inside your app’s container? Or pass it off to some other app, like iBooks?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Pass it off to another app

I got it saving on the simulator to the defual file location but on an actual device when i save it, it is not visiable on the device. How can i change the file directory or get it to work on my device?

If you have a PDF document that you want to share with other apps, you can do that in a variety of ways, including:

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"