Skip to content

Instantly share code, notes, and snippets.

@gin0606
Last active December 17, 2015 20:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gin0606/5670915 to your computer and use it in GitHub Desktop.
Save gin0606/5670915 to your computer and use it in GitHub Desktop.
//
// Created by kkgn06 on 2013/05/29.
//
#import <Foundation/Foundation.h>
@interface NSDictionary (KKWithoutNSNull)
-(id)objectOrNilForKey:(id)key;
@end
//
// Created by kkgn06 on 2013/05/29.
//
#import "NSDictionary+KKWithoutNSNull.h"
@implementation NSDictionary (KKWithoutNSNull)
- (id)objectOrNilForKey:(id)key {
id o = [self objectForKey:key];
if ([o isEqual:[NSNull null]]) {
return nil;
}
return o;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment