Here is my code, but this code is not working is return me an error for permission.
let fileManager = FileManager.default
// Create 'subfolder' directory
do {
try fileManager.createDirectory(atPath: "subfolder", withIntermediateDirectories: true, attributes: nil)
}
catch let error as NSError {
print("Ooops! Something went wrong: \(error)")
}
let documentsUrl:URL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first as URL!
print("\(documentsUrl)")
** error **
oops! Something went wrong: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “subfolder”."