On Aug 10, 2014, at 13:16 , Luc Van Bogaert <luc.van.boga...@me.com> wrote:

> Let's see if I understand this correctly: do you mean I could create a 
> separate model class, eg. "Drawing" with all of it's properties and reference 
> this in my document class as an instance variable or even as a property.
> Then, from my custom view, instead of using [[self.window.windowController 
> document] someProperty]', I could use '[self.window.windowController 
> someProperty]', which in turn would message my model object to return the 
> value of 'someProperty' using 'return [self.document someProperty]' ? 

To be specific:

In a document-based app, I will generally have MyDocument, MyWinController and 
MyModel.

MyDocument has a MyModel property, referencing the model that it loaded from 
the document file (or whatever).

MyWinController has a MyModel property, referencing the same model as the 
document.

A custom MyView would also have a MyModel property referencing the same model, 
initialized in any of various ways depending on how the view was created. The 
view would then use myModel.someProperty whenever it needed it, perhaps even 
binding to it.

Putting a derived “someProperty” directly on the window controller, or even on 
a view controller, *is* feasible too. Often, I find, I use this approach when 
the view presents a somewhat transformed picture of the data model. Databasey 
kinds of apps (such as master/detail) often seem to want to use the real data 
model directly. UIey kinds of apps often seem to want to use a transformed 
model.

_______________________________________________

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