Last active
January 5, 2016 18:55
-
-
Save k06a/6040593 to your computer and use it in GitHub Desktop.
Returns nil if equal to [NSNull null] else return self
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Usage: `[item.self anyMethod]` is valid for `item` equals to `[NSNull null]` | |
// | |
@interface NSNull (SelfOrNil) | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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