I'd like my custom view, not an NSTableView, to display many objects
of a Core Data entity, filtered and sorted. I've got it 90% working,
but the difficulty I'm having with the last few issues makes me think
that maybe my whole approach is wrong. My custom view does not have
any exposed bindings, so I observe using KVO. (The NSArrayController/
NSManagedObjectContext binding is read-only anyhow.)
1. Should/Must I have an NSArrayController? Only NSObjectController
and its subclass NSArrayController seem to have the capability of
operating in "Entity" mode and binding to an NSManagedObjectContext.
In the Cocoa Bindings Reference [1], NSManagedObjectContext is not
even listed. Yet, in Interface Builder, NSObject/ArrayController
can, via my App_Delegate, bind to it (although in [1] this is called
"register"). Are there any examples of viewing the "many" managed
objects of a given entity in a moc without an NSArrayController?
2. Can I use the filtering and sorting capabilities of the array
controller? Seems wasteful not to, but...
3. If so, what key in the array controller can I observe? Issues:
'content' seems to be the only key that is KVC, but it does not
change and therefore does not send observeValueForKeyPath:::: when
object property changes cause a change in the sorted/filtered
output. arrangedObjects seems to mostly work but is not KVC (i.e.
there is no -setArrangedObjects method). Is that OK, since I'm only
'reading'?
4. What is the underlying problem with my approach which is causing
these (and a few other) headaches?