swiftcocoanswindownsdocumentversions

How to tell if NSWindow is being used to browse document versions (right side of version browser UI)


The OS X document versions browser (get to it from File > Revert to > Browse All Versions) shows the current version on the left side and and stack of older versions on the right side.

The window controller on the left side gets notifications letting you know that it's entering/exiting version browsing mode. Also the document for the left hand side returns true. in response to isBrowsingVersions.

But I don't know how to tell when my window is being used to display one of the actual version (the stack on the left side). Those windows don't get the entering/exiting notifications and their document's respond false toisBrowsingVersions`. What's the recommended way to determine if a window is being used to show and old version of a document in the version browser UI?

The two methods that I've found so far are:

  1. NSDocumentController.documents doesn't seem to contain those browed version documents.

  2. The browsed versions documents fileURLs start with file:///.DocumentRevisions.

Is there a better more supported/direct method to determine if my window is browsing an old document version? I need to change some UI behavior in that case.


Solution

  • Few minutes after posting, just figured this out. The answer is that documents on the right side will return true when asked isInViewingMode.