• 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: Best Advice for accessing App Delegate's Managed Object Context
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Best Advice for accessing App Delegate's Managed Object Context


  • Subject: Re: Best Advice for accessing App Delegate's Managed Object Context
  • From: Michael de Haan  <email@hidden>
  • Date: Sun, 18 Oct 2015 12:18:12 -0700

>
> It looks to me like you are instantiating a window controller, not a split view controller.  But that’s a better idea anyhow.


Correct… the WindowController “contains” the SplitViewController

>
>>
>
> By “context”, do you mean managed object context?


correct again.



> Alarm bells go off in my head whenever I see instance variables which are used only as a “shortcut” to objects which are owned by other objects.  I suppose it may not be too dangerous in the case of an app-wide managed object context which you are sure is going to live for the entire run of the app and never be replaced.  But it’s a very odd design, and getting it via a notification is even more odd.



I see your point. In the “real” setup, I would have a coreData class, and use that as a source for all the methods/properties related to the stack.


I have not worked that much with SplitViewControllers, The immediate hurdle was to supply each “child” controller of the splitView with access to the same managedObjectContext. And, as you saw, it involved duplicating code in that childViewController. But, there was also another wrinkle. A race-condition and initially the child controller of the SplitViewController in the stand-alone window, was asking for a managedObjectContext from a stack that was not yet set up. That’s why I turned to notifications, which were only sent after “DidFinishLaunching” was reached.
>
>
>
> _______________________________________________
>
> 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


_______________________________________________

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


  • Follow-Ups:
    • Re: Best Advice for accessing App Delegate's Managed Object Context
      • From: Jerry Krinock <email@hidden>
References: 
 >Best Advice? (From: Michael de Haan  <email@hidden>)
 >Re: Best Advice for accessing App Delegate's Managed Object Context (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: Best Advice for accessing App Delegate's Managed Object Context
  • Next by Date: Re: Best Advice for accessing App Delegate's Managed Object Context
  • Previous by thread: Re: Best Advice for accessing App Delegate's Managed Object Context
  • Next by thread: Re: Best Advice for accessing App Delegate's Managed Object Context
  • Index(es):
    • Date
    • Thread