On Apr 2, 2014, at 6:54 AM, Roland King <r...@rols.org> wrote:

> At this point I realized the NSArrayController was doing nothing. ... I took 
> it out and bound direct to the equivalent properties on the model....

It's not doing nothing.

The NSArrayController doesn't simply "forward" objects from the model to the 
tableview, it has its own copy of the array (the arrangedObjects) which keeps 
it separate the model.

Normally your controller object would have its own copy of the devices array, 
be the delegate and data source for the tableview, providing the filtered and 
sorted data to the tableview, handle the selection notifications and update 
things. Not to mention listen to when the source devices array changes to get a 
new copy of it.

NSArrayController does all of that for you, without interfering with your model.

By binding the table view to the model properties directly, you've now 
established that no other tableview or any other object can have its own 
selection, or order for those objects. You can't sort or filter the tableview 
without sorting or filtering the model data itself, which is most often a bad 
idea.

As for the selection property on your model, you can easily listen to either 
the tableview or the array controller's selection changing, and set the 
property yourself. You're not required or expected to binding everything just 
because you can in some manner.


--
Seth Willits




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to