Is it possible to access the previous / current value of a proxy object using KVO?
I have an NSArrayController and I am using KVO to monitor the old / new values of this select method.
This works great (triggers when the selection changes, normal), except that the items in the change dictionary are null and not the old / new selected object. [arrayController selection] still returns the correct object, but I would like to be able to access the previously selected object if possible (perhaps my workaround would be to observe the selected index and see if that works).
The only possible reason I came across is perhaps because the NSArrayController is a proxy object.
So, is this expected behavior or is something strange going on?
EDIT: I've tried observing only indexes, but that didn't work either. Both old and new keys are still displayed as null.
source to share
mmalc Cocoa bindings page says:
The dictionary of changes does not contain old and new meanings. This is not your fault, due to a bug in the controller. This bug will not be fixed for the foreseeable future.
source to share
For simple KVO (as opposed to bindings) try observing the selectedObjects property instead of the select property. This will give you a simple array of objects instead of the proxy objects used by Cocoa's binding system. I believe the old / new keys should accurately reflect the change in selection in this way.
source to share