Skip to content

Instantly share code, notes, and snippets.

@kostiakoval
Created January 20, 2014 10:31
Show Gist options
  • Save kostiakoval/8517983 to your computer and use it in GitHub Desktop.
Save kostiakoval/8517983 to your computer and use it in GitHub Desktop.
NSDictionary+Networking
//
// NSDictionary+Networking.h
// PocketID
//
// Created by Konstantin Koval on 20/01/14.
// Copyright (c) 2014 Rocketfarm. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSDictionary (Networking)
- (id) safeObjectForKey:(id)aKey;
@end
//
// NSDictionary+Networking.m
// PocketID
//
// Created by Konstantin Koval on 20/01/14.
// Copyright (c) 2014 Rocketfarm. All rights reserved.
//
#import "NSDictionary+Networking.h"
@implementation NSDictionary (Networking)
- (id) safeObjectForKey:(id)aKey
{
id obj = [self objectForKey: aKey];
if ([obj isKindOfClass: [NSNull class]]) {
obj = nil;
}
return obj;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment