Re: Swift with NSDocument and Revert To... browse all versions.

Quincey Morris

On Jul 12, 2018, at 03:37 , Bill Pitcher <bill@...> wrote:

After returning from Revert To... restoring an old document, my document flicks back to displaying the original data when went into the version browser, BUT the backing document has been resorted correctly. Doing an UpdateMyControls in windowDidExitVersionBrowser does a bad visual, from new to old then new again.

Propagate the data reversion to your window controller and view controllers can be difficult, because any setup you did in windowDidLoad/viewDidLoad is not automatically redone. It can be especially confusing when the document (and the data model it provides/contains) is reverted, but individual references within you controller hierarchy refer to (and keep alive) various bits of the data model objects that were supposed to be discarded.

It’s also possible to be propagating the model data correctly to the view controllers, but still have the wrong information showing in the views because the propagation wasn’t fully KVO compliant.

There probably isn’t a simple way to solve this, other than the brute force approach of tracking the model data through the controllers to make sure it’s all being updated when necessary.

Join to automatically receive all group messages.