문제

I have the following enum:

typedef NS_ENUM(NSUInteger, GraphType) {
    GraphTypeRawData,
    GraphTypeFilteredData
};

The compiler accepts without warning me declaring it as a property primitive, or as a pointer:

@property (nonatomic, assign) GraphType graphType;

VS

@property (nonatomic, assign) GraphType *graphType;

Which is the correct one to use? (And why?)

도움이 되었습니까?

해결책

It's a primitive type. Don't use a pointer unless you have a very clear and specific reason to track a pointer to a primitive type (which will be very rare).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top