• 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 in NSApplication
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Global in NSApplication


  • Subject: Re: Global in NSApplication
  • From: BareFeet <email@hidden>
  • Date: Wed, 27 Jan 2010 19:50:05 +1100

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 (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: Global in NSApplication
      • From: Scott Ribe <email@hidden>
References: 
 >Re: Global in NSApplication (From: BareFeet <email@hidden>)
 >Re: Global in NSApplication (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Launch process as root from cocoa app
  • Next by Date: RE: Hyperlinks in Table Views
  • Previous by thread: Re: Global in NSApplication
  • Next by thread: Re: Global in NSApplication
  • Index(es):
    • Date
    • Thread