Skip to content

Instantly share code, notes, and snippets.

@johncblandii
Created October 22, 2013 19:34
Show Gist options
  • Save johncblandii/7106773 to your computer and use it in GitHub Desktop.
Save johncblandii/7106773 to your computer and use it in GitHub Desktop.
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