This code won't compile and generates the error message "Expected a type". As the type is declared right above I don't understand why.
enum TMyType
{
Etype1,
Etype2
};
@interface Factory : NSObject
+ (void) foo: (TMyType) actionType;
@end
To define a custom type, the correct way is with a typedef.
Try...
typedef enum
{
Etype1,
Etype2
} TMyType;
EDIT: Not long after this question was asked and answered, Apple came out with a new way to do enumerated data types. Here's an in-depth article on it.
typedef NS_ENUM(NSInteger, TMyType) {
Etype1,
Etype2
};
+ (void) foo: (enum TMyType) actionType;
or use .mm
(and retag question with objective-c++
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With