I've implemented the NSFilePresenter protocol in a Mac app (Catalina 10.15.3 Xcode 10.15.3) to watch a directory.
Most protocol methods get called correctly, but some don't get called at all. For some there are (cumbersome) alternatives, but if, for example a file is immediately deleted in Finder using option+command+del, the NSFilePresenter delegate never receives any callback. Is there a workaround to trigger the callbacks?
final class FileController: NSObject, NSFilePresenter {
...
init() {
presentedItemURL = // Some directory
NSFileCoordinator.addFilePresenter(self)
}
func accommodatePresentedItemDeletion(completionHandler: @escaping (Error?) -> Void) {
// Never gets called
completionHandler(nil)
}
func presentedSubitemDidAppear(at url: URL) {
// Never gets called
}
func presentedSubitemDidChange(at url: URL) {
// Does get called
}
}