iOS 12.1.0 + Xcode 10.1
I am using URLs with bookmarks to keep recents.
When I trashed a file, its bookmark results a URL in a trash.
If the trashed file was located in my iPad, I can check if the file is in the current user's trash.
do {
var relationship = FileManager.URLRelationship.other
try FileManager.default.getRelationship(&relationship, ofDirectoryAt: trashUrl, toItemAt: url)
if relationship == .contains {
return true
}
} catch {
print(error.localizedDescription)
}
If the trashed file was in iCloud or any other clouds, how can I check if the file is in trash or not?
Thank you~ ^^
Is there any better way?
I’m not sure, but any way that involves hard coding
.Trash
is not good.
for SearchPathDirectory does not work.trashDirectory
When dealing with the trash it’s critical that you call a routine, like
url(for:in:appropriateFor:create:)
, that lets you pass in an ‘appropriate URL’ parameter, because the trash can be different for different parts of the file system.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"