Skip to content

Instantly share code, notes, and snippets.

@advantis
Created April 29, 2013 18:39
Show Gist options
  • Save advantis/5483719 to your computer and use it in GitHub Desktop.
Save advantis/5483719 to your computer and use it in GitHub Desktop.
defaults[@"key"]
//
// Copyright © 2013 Yuri Kotov
//
#import <Foundation/Foundation.h>
@interface NSUserDefaults (ADVKeyedSubscript)
- (id) objectForKeyedSubscript:(NSString *)key;
- (void) setObject:(id)object forKeyedSubscript:(NSString *)key;
@end
//
// Copyright © 2013 Yuri Kotov
//
#import "NSUserDefaults+ADVKeyedSubscript.h"
@implementation NSUserDefaults (ADVKeyedSubscript)
- (id) objectForKeyedSubscript:(NSString *)key
{
return [self objectForKey:key];
}
- (void) setObject:(id)object forKeyedSubscript:(NSString *)key
{
[self setObject:object forKey:key];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment