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

Était-ce utile?

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top