> On 22 Sep 2015, at 14:40, Jim Thomason <j...@jimandkoka.com> wrote: > > First, to be clear, I'm not actually trying to do this. I'm just curious > how it could be done. I cooked it up while working on other things. > > The question is simple - is there a reasonable way to create two > NSArrayControllers, have them bound to an entity through CoreData, and keep > them in sync? > > So there's ControllerA, which populates TableA; and ControllerB, which > populates TableB. Neither of them have an explicit bound contentArray, they > just load up all of their associated entities straight from the > managedObjectContext. > > I'd like to be able to add an object into ControllerA, and have it > automatically show up in ControllerB. I haven't figured out a way to do it. > > If they were both bound to the same contentArray, it's no problem - the > content automatically shows up. But if it's loaded via the fetch request, > then some other mechanism needs to come into play. > > Subclassing them both and having A post a notification so that B re-fetches > its content is the best solution I've got, but I figured I'd ask around and > see if anybody else had a more clever approach.
Array Controllers etc. can be configured to monitor their context for changes and automatically re-fetch when needed. So they should keep in sync that way without any extra work. _______________________________________________ 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