• 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
Re: Retrieve NSTable DataSource from AppController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Retrieve NSTable DataSource from AppController


  • Subject: Re: Retrieve NSTable DataSource from AppController
  • From: Quincey Morris <email@hidden>
  • Date: Sat, 18 Jun 2011 11:29:22 -0700

On Jun 18, 2011, at 10:43, Kevin Muldoon wrote:

> I have an NSTable which receives its dataSource from MyTableController.m. However, my AppController.m needs the data MyTableController.m holds. Since AppController.m hasn't explicitly instantiated MyTableController (MyTableController being an NSObject within IB with appropriate delegates and such) how does AppController.m access MyTableController.m data?

Well, you're torturing the MVC paradigm, and it's fighting back.

A data source is a delegate-style object, but it's not really intended to "contain" the data. The data source extends the behavior of a controller object; the data should be in a data model. It's certainly *permissible* to merge the two, but that's for the case where the controller is the only thing that needs the data -- which isn't this case.

As a generic problem, though, it's not that hard. If object A creates object B which creates object C, and object A needs to access object C, then clearly B must have a public interface that returns a pointer to C. In other words, object B should have a property whose value is a pointer to C.

But based on your description, don't use this solution in this case. Create an actual data model._______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >Retrieve NSTable DataSource from AppController (From: Kevin Muldoon <email@hidden>)

  • Prev by Date: Re: Drawing focus rings
  • Next by Date: Re: Branch: Drawing noise in Cocoa (preferably fast)
  • Previous by thread: Retrieve NSTable DataSource from AppController
  • Next by thread: Re: Retrieve NSTable DataSource from AppController
  • Index(es):
    • Date
    • Thread