Re: Is there a pattern for creating an object with global scope?
Re: Is there a pattern for creating an object with global scope?
- Subject: Re: Is there a pattern for creating an object with global scope?
- From: Alex Zavatone <email@hidden>
- Date: Sat, 13 Apr 2013 00:17:21 -0400
FYi, it's advice, not advise.
Advice is what you give, advise is the giving of advice.
But I like Matt Galloway's singleton approach for a class you can import and use everywhere.
http://www.galloway.me.uk/tutorials/singleton-classes/
On Apr 12, 2013, at 9:30 PM, YT wrote:
> Perhaps my approach is wrong. Looking for advise.
>
> So I'd like to define a Class called Preference.
>
> In main.m I'd like to create an object called myPreferences before the code line
>
> return NSApplicationMain(argc, (const char**)); is run;
>
> I assume the object myPreferences will persist the life of the program.
>
> So how can I make the ID of myPreferences known to all objects in the program?
>
> Is this even possible?
>
> OK! So I'm trying to create an object with global scope so all other objects can get and put data in it.
>
> AND OK! Its true I'm not yet a mature Objective-C programmer. Ya know one that doesn't know what I can't do.
>
> YT
> _______________________________________________
>
> 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
_______________________________________________
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