Skip to content

Instantly share code, notes, and snippets.

@beny
Created June 4, 2015 14:26
Show Gist options
  • Save beny/000ea1cc869c1ac7d986 to your computer and use it in GitHub Desktop.
Save beny/000ea1cc869c1ac7d986 to your computer and use it in GitHub Desktop.
Objective-C inline functions & macros
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