On 27/01/2010, at 5:02 PM, Graham Cox wrote:

> The singleton pattern Jens suggested is simpler. I can't think of any simpler 
> way:
> 
> + (Debug*)            sharedDebug
> {
>    static Debug* s_debug = nil;
> 
>    if( s_debug == nil )
>        s_debug = [[self alloc] init];
> 
>    return s_debug;
> }
> 
> 
> Then whenever you need the debug object, just call:
> 
> [Debug sharedDebug];
> 
> The first time it's needed it will be created.

Thanks Graham and Jens. That does appear to be a simpler way to do it and seems 
to be working fine for me :-)

Tom
BareFeet

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to