-
-
Save heliang219/a090c62ce6ea8ff57a6d14433ae1506e to your computer and use it in GitHub Desktop.
Exhaustively check if an Objective-C object is "empty"
This file contains hidden or 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
| static inline BOOL CBIsEmpty(id obj) { | |
| return obj == nil | |
| || (NSNull *)obj == [NSNull null] | |
| || ([obj respondsToSelector:@selector(length)] && [obj length] == 0) | |
| || ([obj respondsToSelector:@selector(count)] && [obj count] == 0); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment