I am trying to download one text file from the server and I have completed it. Also, I have stored that file but it seems like it stores at some private location and not able to access that file from other file explorer.
Heres the code for it:
let documentsUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first
// let destinationUrl = documentsUrl!.appendingPathComponent("10xFile.pdf")
let fileManager = FileManager.default
do {
let documentDirectory = try fileManager.url(for: .documentDirectory, in: .userDomainMask, appropriateFor:nil, create:false)
let fileURL = documentDirectory.appendingPathComponent("10xFile.pdf")
let dataFromURL = NSData(contentsOf: location)
dataFromURL?.write(to: fileURL as! URL, atomically: true)
} catch {
print(error)
}
But I need to access this file very easily by any other file explore.
Thanks in advance