-
Copy the header file to your project
-
Import the header file
#import "enum_generator.h"
- Define your custom Enum
#define WorkStatus(XX) \
XX(WorkStatusUnKnown,) \
XX(WorkStatusWorking,) \
XX(WorkStatusSleeping,=50)
DECLARE_ENUM(WorkStatus, WorkStatus)
- enjoy it😆
WorkStatus testWorkStatus = WorkStatusUnKnown;
NSLog(@"workstatus is: %@", stringFromWorkStatus(testWorkStatus));
if (testWorkStatus == WorkStatusFromString(@"WorkStatusUnKnown")) {
NSLog(@"确认在摸鱼");
}