Question

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?)

Was it helpful?

Solution

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top