> On Mar 21, 2017, at 6:26 AM, Daryle Walker <dary...@mac.com> wrote: > > A design for my third window iteration involves using several > NSViewController subclasses in a UI tree. The current (i.e. second) version > just has the root NSViewController and a bunch of NSView objects. There is a > NSObjectController and a NSArrayController to bind the various view objects > to my CoreData-based document data. > > Since all the objects are together, I can make a big Bindings network. The > new design would spread the components. I need the object controllers to > synchronize their editing notifications. I'm wondering how. > > I'm half asleep, but I'm thinking of starting with the NSWindowController > with a reference to the model and one NSObjectController. That object > controller points to the model and it's managed context. For all the > NSViewControllers in the tree, they'll use the first object controller as > their represented object and reference it for their Bindings needs. Would > that work?
You didn’t sat whether your data model is monolithic (e.g. all properties of a single object) or a strcutured collection of objects, but in any case I have implemented similar structures and I would say that, generally, if your design warrants distinct component views, then your data model also warrants encapsulating the corresponding data components. I.e. the data structure would mirror the view structure to some extent. This isn’t necessary, but IMHO is clearer. Worst case you simply set every view controller’s representedObject to the entire document model. I don’t recommend creating complex binding chains as they can be difficult to manage and debug. You only need an object controller for each view, and there is no need for controllers to synchronize as that will happen automatically with model changes. HTH, Keary Suska Esoteritech, Inc. "Demystifying technology for your home or business" _______________________________________________ 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