First just to clear a distraction...  

I didn't want to actually create my own version of Preferences.  In fact that 
was a mistake to even mention it.  Sorry, I was flailing in my mind trying to 
describe what I was struggling with and out came Preferences as an example.  
Totally throw away the notion of creating a Preferences Object.

My struggle is partially due to my lack of experience in OOP. I just have not 
written enough OO code as of yet.  AND I'm very new to Objective-C. Hence my 
lack of experience and working knowledge of Objective-C.

Scott Ribe sited a working example that I could instantly understand, since I 
have lots of experience in good 'ole Standard C. 

Yes, extremely easy, just "create" the var, as in:

int gFoobar = 42;

Then reference it elsewhere as:

extern int gFoobar;

I understand that solution and its working for me right now.  I have a PreRun 
Class that defines the object and I instantiate in main.m just before the line 
return NSApplicationMain(argc, (const char **)argv);
runs in main.m.  The object instance persists the entire program run. THEN I 
simply extern the global var that holds the pointer to the object in all of the 
Class files where its required to access it.  

It may be a violation of OOP theory and application, it may be considered a 
kludge BUT it works right now.  I am willing to move to a conventional OOP 
solution if I could figure out how.

Reading Apple Documentation is like reading UNIX Man pages - groan, beat me 
with a stick but don't make me read UNIX Man Pages - sigh.

As suggested I read "some" on NSUserDefaults - I'm not sure how this would 
provide what I need, perhaps more reading here.

As Suggested I looked up the notion of a Singleton and Creating a Singleton 
Instance - Looks promising BUT since I have little experience to date on 
deciphering Apple Objective-C documentation it has created more unanswered 
questions rather than producing working code. SIGH!  More reading in my future 
and stumbling in the dark.  

YT





.




_______________________________________________

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

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

Reply via email to