Skip to content

Instantly share code, notes, and snippets.

@nielsbot
Last active December 11, 2015 22:28
Show Gist options
  • Save nielsbot/4669657 to your computer and use it in GitHub Desktop.
Save nielsbot/4669657 to your computer and use it in GitHub Desktop.
Tired of dealing with NSNull in your KVO observers? I use this.
@implementation NSNull (IfNullThenNil)
-(id)ifNullThenNil { return nil ; }
@end
@implementation NSObject (IfNullThenNil)
-(id)ifNullThenNil { return self ; }
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment