Skip to content

Instantly share code, notes, and snippets.

@mysteriouspants
Created May 11, 2012 15:52
Show Gist options
  • Save mysteriouspants/2660581 to your computer and use it in GitHub Desktop.
Save mysteriouspants/2660581 to your computer and use it in GitHub Desktop.
Save app delegates everywhere by shoving static data into C functions!
NSDictionary * sharedFoo() {
static NSDictionary * foo;
static dispatch_once_t f;
dispatch_once(f, ^{
foo = [NSDictionary dictionaryWithObjectsForKeys:
@"bar", @"foo"];
};
return foo;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment