Skip to content

Instantly share code, notes, and snippets.

@k06a
Last active January 5, 2016 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k06a/6040593 to your computer and use it in GitHub Desktop.
Save k06a/6040593 to your computer and use it in GitHub Desktop.
Returns nil if equal to [NSNull null] else return self
//
// Usage: `[item.self anyMethod]` is valid for `item` equals to `[NSNull null]`
//
@interface NSNull (SelfOrNil)
@end
@implementation NSNull (SelfOrNil)
- (instancetype)self {
return nil;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment