Re: Automagic instantiation of singletons?
Re: Automagic instantiation of singletons?
- Subject: Re: Automagic instantiation of singletons?
- From: Shawn Erickson <email@hidden>
- Date: Fri, 18 Nov 2005 07:47:05 -0800
On Nov 18, 2005, at 4:47 AM, Jonathan del Strother wrote:
Is there any way to persuade a singleton object to create itself?
I have a few singleton objects that need to exist throughout the
lifetime of the application, and am currently instantiating them in
my application controller's applicationDidFinishLaunching: method.
It would be nice if I didn't have to explicitly do this. My
initial thought was that you could do it through the singletons' +
(void)initialize method - but of course, this isn't called at
application startup - it's only called the first time you try and
access the object, so it still needs to be manually set up.
Any other suggestions? I suspect it's not actually possible, but
thought I'd throw it out to the obj-c gurus and see what they have
to say...
Apple take on this...
<http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaObjects/Articles/CreateSingleton.html>
Others...
<http://www.cocoadev.com/index.pl?SingletonDesignPattern>
<http://www.cocoadev.com/index.pl?FTSWAbstractSingleton>
-Shawn
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden