Created
June 4, 2015 14:26
-
-
Save beny/000ea1cc869c1ac7d986 to your computer and use it in GitHub Desktop.
Objective-C inline functions & macros
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
static inline BOOL isEmpty(id thing) { | |
return (thing == nil) | |
|| ([thing respondsToSelector:@selector(length)] && [thing length] == 0) | |
|| ([thing respondsToSelector:@selector(count)] && [thing count] == 0) | |
|| ([thing isKindOfClass:[NSNull class]]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment