What is the difference between NS_ENUM and NS_OPTIONS?

前端 未结 4 1538
轻奢々
轻奢々 2021-01-30 04:47

I preprocessed following code with clang in Xcode5.

typedef NS_ENUM(NSInteger, MyStyle) {
    MyStyleDefault,
    MyStyleCustom
};

typedef NS_OPTIONS(NSInteger,         


        
4条回答
  •  梦谈多话
    2021-01-30 04:53

    The only difference is to let developers using the values know if it makes sense to use them in an OR'ed bitmask.

    The compiler doesn't care which one you use though :)

提交回复
热议问题