NSDocument, callback when renaming document from title bar

How do I get updates about the file name change from the NSDocument window title? I noticed that despite file being property registered as a file presenter (by default), none of presentedItemDidChange, presentedSubitemDidChange, or presentedItemDidMove is called despite filename updates on the filesystem.

the presentedItemURL does update value at some point.

My subclass has autosave enabled, which makes title editing possible.

override class var autosavesInPlace: Bool {
    true
}

[object Object]

Try overriding -moveToURL:completionHandler: on NSDocument

- (void)moveToURL:(NSURL *)url 
completionHandler:(void (^)(NSError *))completionHandler
{
   [super moveToURL:url completionHandler:^(NSError * _Nullable theError)
  {
         if (theError == nil)
        {
            //no error, file was moved....
        }
       else 
       {
         //error.....
       }

       //Call the original completion handler
        if (completionHandler != nil) { completionHandler(theError); }
  }];
}
NSDocument, callback when renaming document from title bar
 
 
Q