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