• 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
Is there a pattern for creating an object with global scope?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is there a pattern for creating an object with global scope?


  • Subject: Is there a pattern for creating an object with global scope?
  • From: YT <email@hidden>
  • Date: Fri, 12 Apr 2013 18:30:17 -0700

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

  • Follow-Ups:
    • Followup - Re: Is there a pattern for creating an object with global scope?
      • From: YT <email@hidden>
    • Re: Is there a pattern for creating an object with global scope?
      • From: Alex Zavatone <email@hidden>
    • Re: Is there a pattern for creating an object with global scope?
      • From: Scott Ribe <email@hidden>
    • Re: Is there a pattern for creating an object with global scope?
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: Restoring unsaved docs does wrong thing
  • Next by Date: Re: Is there a pattern for creating an object with global scope?
  • Previous by thread: Re: Restoring unsaved docs does wrong thing
  • Next by thread: Re: Is there a pattern for creating an object with global scope?
  • Index(es):
    • Date
    • Thread