A user of my app noticed that when using it to move a file to the trash on an USB drive, the trash doesn't show the file until unmounting the drive and mounting it again. I was able to reproduce it with one of my own USB drives, but with another USB drive it doesn't reproduce. All USB drives are formatted APFS.
When moving a file to the trash from the Finder, both USB drives immediately list it in the trash. Is this a macOS bug, or am I doing something wrong?
I created FB19941168.
let openPanel = NSOpenPanel()
openPanel.runModal()
let url = openPanel.urls[0]
do {
var result: NSURL?
try FileManager.default.trashItem(at: url, resultingItemURL: &result)
print(result as Any)
} catch {
fatalError(error.localizedDescription)
}