I use the code below to rename a file, it works ok, but then the system calls accommodatePresentedItemDeletion(completionHandler:) on a NSFilePresenter that presents the file, immediately after the call to presentedItemDidMove(to:) What am I doing wrong?
NSFileCoordinator().coordinate(writingItemAt: oldURL, options: .forMoving, writingItemAt: newURL, options: [], error: &error)
{ (actualURL1, actualURL2) in
do {
coordinator.item(at: actualURL1, willMoveTo: actualURL2)
try FileManager().moveItem(at: actualURL1, to: actualURL2)
coordinator.item(at: actualURL1, didMoveTo: actualURL2)
} catch {...}
}