I am doing a scanner app that scans a picture and converts it into a PDF. I want to be able to save it to "On My IPhone" but I do not know that path URL. Here is what I have so far:
let data = pdfDocument.dataRepresentation()
let documentsDirectoryURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
let currentTimeStamp = String(Int(NSDate().timeIntervalSince1970))
let docURL = documentsDirectoryURL.appendingPathComponent("Scan\(currentTimeStamp).pdf")
do{
try data?.write(to: docURL)
}catch(let error)
{
print("error is \(error.localizedDescription)")
}
However, the I cannot find my file on my phone because I do not know what "Directory" URL is. How can I get my PDF to save to my iPhone Storage? What is the URL to my "On My IPhone" folder?
Thanks in advance.