Create a gist now

Instantly share code, notes, and snippets.

This is a class with static methods for saving user defaults.
#import "Preferences.h"
@implementation Preferences
+(id)getUserPreference:(NSString*)forKey
{
NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
return [defaults valueForKey:forKey];
}
+(void)setUserPreference:(id)value forKey:(NSString*)key
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:value forKey:key];
[defaults synchronize];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment