Adam, I've noted a few bugs in your fileview bindings.

Most important is that that you're observing the wrong keyPath for the  
content binding ("content" is the name on the FileView, keyPath is the  
path on the observable).

Also, it's wrong to assume that the observed value is a proxy mutable  
array. In fact, you should always copy the array and properly update  
in the KVO observation (in bindings it's important that arrays and  
sets are not supposed to be mutable when passed around, otherwise KVO  
can get upset, I've run into that problem several times, this in  
contradistinction to a dictionary, which should not be copied, as it  
is observed). Also you should not need to implement KVC accessors for  
content. I think the problem with IB you note may have to do with the  
fact that you don't update the value initially in -bind:..., I usually  
do that by explicitly calling a KVO observation from -bind:...

Also, selectionIndexes could easily go through the default binding  
mechanism, as it's a KVC compliant key.

I think the self observation of selectionindexes is dangerous.  
Updating a binding should never be triggered by the setter, you never  
know what loops are there. It should always be similar to actions:  
triggered by a user interaction. Moreover there's the  
viewWillMoveToSuperview hack. I have done this by adding a private  
version of setSelectionIndexes: that updates the binding and anything  
that's needed, and use that internally.

Also, iconScale can be changed from within the fileView (through the  
slider), so it makes sense to make it 2-way. This also should be done  
explicitly, not through KVO. For this reason, and also the  
viewWillMoveToSuperview hack, I found it much easier to update the  
slider manually rather than through binding, binding in this case is  
really not advantageous, and rather leads to problems.

Christiaan


------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Bibdesk-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-develop

Reply via email to