• 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: Kirk Kerekes <email@hidden>
  • Date: Tue, 29 Jul 2008 18:19:13 -0500

Consider class methods instead of globals. See:

<http://www.thotzy.com/THOTZY/Robust_Cocoa_Coding.html>

Unmentioned there is the additional advantage of lazy initialization: (composed in Mail)

+ (NSMutableDictionay *) myGlobalDict
{
static NSMutableDictionary * result = nil;
if(!result)
	{
	result = [[self myComplicatedGlobalFactoryMethod] retain]
	}
return result;
}

Caveat: Multi-threaded access may require additional precautions, depending on sequence.


_______________________________________________

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


  • Prev by Date: Re: bug in PhotoSearch
  • Next by Date: Re: private methods and variables
  • Previous by thread: Re: global NSMutableDictionary
  • Next by thread: Re: global NSMutableDictionary
  • Index(es):
    • Date
    • Thread