Skip to content

Instantly share code, notes, and snippets.

@hmhmsh
Last active November 30, 2017 06:19
Show Gist options
  • Save hmhmsh/a039fa12afa1318ef6324d19dfb386c5 to your computer and use it in GitHub Desktop.
Save hmhmsh/a039fa12afa1318ef6324d19dfb386c5 to your computer and use it in GitHub Desktop.
- (id)getUserDefaultsWithKey:(NSString*)key {
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
id value = [ud boolForKey:key];
return value;
}
- (void)saveUserDefaultsWithInteger : (NSInteger)value key:(NSString*)key {
NSUserDefaults* ud = [NSUserDefaults standardUserDefaults];
[ud setIntegert:value forKey:key];
[ud synchronize];
}
// - (void)setFloat:(float)value forKey:(NSString *)defaultName;
// - (void)setDouble:(double)value forKey:(NSString *)defaultName;
// - (void)setBool:(BOOL)value forKey:(NSString *)defaultName;
// - (void)setURL:(nullable NSURL *)url forKey:(NSString *)defaultName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment