Skip to content

Instantly share code, notes, and snippets.

@alvinsj
Created December 4, 2012 03:41
Show Gist options
  • Save alvinsj/4200311 to your computer and use it in GitHub Desktop.
Save alvinsj/4200311 to your computer and use it in GitHub Desktop.
support for NS_ENUM and NS_OPTIONS in iOS 5
#if (__cplusplus && __cplusplus >= 201103L && (__has_extension(cxx_strong_enums) || __has_feature(objc_fixed_enum))) || (!__cplusplus && __has_feature(objc_fixed_enum))
#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
#if (__cplusplus)
#define NS_OPTIONS(_type, _name) _type _name; enum : _type
#else
#define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type
#endif
#else
#define NS_ENUM(_type, _name) _type _name; enum
#define NS_OPTIONS(_type, _name) _type _name; enum
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment