• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
cocoa MVC design question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cocoa MVC design question


  • Subject: cocoa MVC design question
  • From: Derrek Leute <email@hidden>
  • Date: Fri, 6 Oct 2006 19:02:31 -0400


I want to use NSTreeController to provide a hierarchy of data for the user using NSOutlineView.


My problem is each "level" of the hierarchy is populated differently from my model (file system, sql... etc). Therefor, I can't just use NSMutableDictionary like I have in the past.

From an MVC stand point what is the best solution?

I can see several options:

1. Subclass NSTreeController putting definitive structure logic here. Calling my other controllers as necessary to actually obtain and display the data. (I'm not entirely sure how this would work but I know people do it for a variety of reasons, so I mention it first).

2. Create a wrapper class/object (or perhaps a Protocol) that wraps *all* of my various types of model objects from the hierarchy. Each class object would conform to this protocol (displayName and other accessors would be part of it). What does the children key path need to return in this case? An NSArray of the children objects?

Is #2 what the documentation means when it says:

"All child objects for the tree must be key-value-coding compliant for the same child key path. If necessary you should implement accessor methods in your model classes, or categories on those classes, that map the child key to the appropriate class-specific method name."

3. A third option I'm not aware of? Are there advantages or disadvantages I should be aware of between these two methods?

Thanks!

--Derrek
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: WhackedTV - ISO C++ forbids declaration of 'SeqGrabComponent' with no type
  • Next by Date: Re: Core Data getting many data from relationship.
  • Previous by thread: Re: WhackedTV - ISO C++ forbids declaration of 'SeqGrabComponent' with no type
  • Next by thread: Altering the behavior of NSUserDefaults
  • Index(es):
    • Date
    • Thread