I'm trying to show my data in my app in the Files app on my iPhone I searched a lot and did everything right, I don't know where the error is
func fileManger(nameFolder: String) {
let manager = FileManager.default
let DecomentFolder = manager.urls(for: .documentDirectory, in: .userDomainMask).last
let Folder = DecomentFolder?.appendingPathComponent("\(nameFolder)")
do {
try manager.createDirectory(at: Folder!, withIntermediateDirectories: true, attributes: [:])
} catch let error {
print(error.localizedDescription)
}
}
Also here I am sending the value to be a folder
@objc func alertNewFolder () {
let alert = UIAlertController(title: "Create an album", message: "", preferredStyle: .alert)
alert.addTextField(configurationHandler: nil)
alert.textFields![0].placeholder = "name album"
alert.textFields![0].textAlignment = .right
alert.addAction(UIAlertAction(title: "cancel", style: .cancel, handler: nil))
alert.addAction(UIAlertAction(title: "save", style: .default, handler: { ـ in
if let textFileds = alert.textFields {
let links = textFileds[0].text
self.arrS1.append(addCatogrey(nameCatog: links!, imageSection: UIImage(named: "folder")))
// Here Send FileManager
helperCoding().fileManger(nameFolder: links!)
self.collection.reloadData()
}
}))
self.present(alert, animated: true, completion: nil)
}
In the Simulators it saved in the Documents folder here correctly
/Users/badrshammry/Library/Developer/CoreSimulator/Devices/7986A27F-7026-45E1-9073-78CCD6A9B90A/data/Containers/Data/Application/3173C4DC-BCDE-41B9-89E1-6E8D9B52EF25/Documents