Skip to content

Instantly share code, notes, and snippets.

@cxa
Created Sep 12, 2011
Embed
What would you like to do?
NSUserDefaults shortcut
#define DEFAULTS(type, key) ([[NSUserDefaults standardUserDefaults] type##ForKey:key])
#define SET_DEFAULTS(Type, key, val) do {\
[[NSUserDefaults standardUserDefaults] set##Type:val forKey:key];\
[[NSUserDefaults standardUserDefaults] synchronize];\
} while (0)
@CocoaBob
Copy link

Very nice idea, but how can we get rid of the warnings like "warning: passing argument 1 of 'setBool:forKey:' makes integer from pointer without a cast"?

@humbroll
Copy link

humbroll commented Dec 4, 2013

Love it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment