• 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: global NSMutableDictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: global NSMutableDictionary


  • Subject: Re: global NSMutableDictionary
  • From: Nathaniel Gottlieb-Graham <email@hidden>
  • Date: Tue, 29 Jul 2008 14:25:34 -0400

Holy moly, that's just what I needed. This dictionary in fact originated in the controller app delegate, and I had no idea you could reference things inside the app delegate like that! Thanks so much!


On Jul 29, 2008, at 2:16 PM, I. Savant wrote:

On Tue, Jul 29, 2008 at 1:57 PM, Nathaniel Gottlieb-Graham
<email@hidden> wrote:
I am trying to implement a global variable that's an NSMutableDictionary.

In addition to Bill's response, I'd like to take a different direction. :-) Why are you trying to implement this as a global? Typically (in the world of Cocoa), you'd have some central controller that acts as your "app delegate". This controller would keep references to things you might want to access from any part of your app.

 Consider having a controller class designated as your app's
delegate. Assume your dictionary is an instance variable of that
controller called "fooDict". Your app delegate controller would
contain a convenience method to return (or create and return) that
dictionary:

- (NSMutableDictionary *)fooDict
{
 // Possibly create (and ensure retention of) fooDict here
 return fooDict;
}

 ... then, from anywhere in your app, you can ask the controller for
its fooDict like this:

id fooDict = [[NSApp delegate] fooDict];

 I hope this helps (or is at all relevant to your goal).

--
I.S.

_______________________________________________

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: 
 >global NSMutableDictionary (From: Nathaniel Gottlieb-Graham <email@hidden>)
 >Re: global NSMutableDictionary (From: "I. Savant" <email@hidden>)

  • Prev by Date: Re: global NSMutableDictionary
  • Next by Date: Where'd my debugging statements go?
  • Previous by thread: Re: global NSMutableDictionary
  • Next by thread: Re: global NSMutableDictionary
  • Index(es):
    • Date
    • Thread