Skip to content

Instantly share code, notes, and snippets.

@jdg
Created October 2, 2009 04:01
Show Gist options
  • Save jdg/199451 to your computer and use it in GitHub Desktop.
Save jdg/199451 to your computer and use it in GitHub Desktop.
// by Wil Shipley
// from: http://www.wilshipley.com/blog/2005/10/pimp-my-code-interlude-free-code.html
static inline BOOL IsEmpty(id thing) {
return thing == nil
|| ([thing respondsToSelector:@selector(length)]
&& [(NSData *)thing length] == 0)
|| ([thing respondsToSelector:@selector(count)]
&& [(NSArray *)thing count] == 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment