Re: global NSMutableDictionary
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