Objective-C Singleton Pattern

The Singleton pattern in Objective-C is a great way of creating a global single-instance of an object, and we do see them in abundance even within Apple's own SDK, as Luke Redpath identifies:
[NSUserDefaults standardUserDefaults]
Even accessing AppDelegate, you can access properties:
(anAppDelegate*)[[UIApplication sharedApplication] delegate]

 

There are a few articles on the web on how to create such global convenience classes, that allow you to reference a single true source of property values, but trying to find one that is ARC-compliant is a bit trickier. Thankfully, Luke Repath has created a macro that would help with this. In fact, it's dead simple, and in three steps.
Step One and Two:
Create a macro, like in your app's .pch file,  as follows:
[gist id=1057420]
The second snipped shows how you would create that specific class you wish to share across your app.
Step Three:
Powered with your macro, created in the first step, you get predictive text where you refer or link up to your shared class:
SINGELTON_GCD(MyClass);

That's it, you can access shared properties inside your object throughout your application.

Doron KatzObjective-C