On Apr 12, 2013, at 6:54 PM, Scott Ribe <scott_r...@elevated-dev.com> wrote:

> Yes, extremely easy, just "create" the var, as in:
> 
> int gFoobar = 42;

YT wants to create an object, which isn’t as straightforward because you can’t 
have an object literal in Objective-C. Instead you declare a global pointer and 
initialize it early on.

MyClass* gMyObject;

Then early at launch time:

        gMyObject = [[MyClass alloc] init];

That second line could go into the -applicationDidFinishLaunching: method, 
which is the usual place where stuff gets initialized.

That said, Graham is right that you should use NSUserDefaults to store 
preferences instead of making your own class.

—Jens
_______________________________________________

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