Many answers all fairly good.
If you are after a generic, Objective C solution that uses some macros...
Key feature is it uses the enum as an index into a static array of NSString constants.
the array itself is wrapped into a function to make it more like the suite of NSStringFromXXX functions prevalent in the Apple APIs.
you will need to `#import "NSStringFromEnum.h"` found here
[To see links please register here]
[EDIT]
also needs `#import "SW+Variadic.h"` found here
[To see links please register here]
Example 1 : completely define a NEW enum typedef, with string converters.
in myfile.h
--------------------------------------------------------
#import "NSStringFromEnum.h"
#define define_Dispatch_chain_cmd(enum)\
enum(chain_done,=0)\
enum(chain_entry)\
enum(chain_bg)\
enum(chain_mt)\
enum(chain_alt)\
enum(chain_for_c)\
enum(chain_while)\
enum(chain_continue_for)\
enum(chain_continue_while)\
enum(chain_break_for)\
enum(chain_break_while)\
enum(chain_previous)\
enum(chain_if)\
enum(chain_else)\
interface_NSString_Enum_DefinitionAndConverters(Dispatch_chain_cmd)
--------------------------------------------------------
in myfile.m:
--------------------------------------------------------
#import "myfile.h"
implementation_NSString_Enum_Converters(Dispatch_chain_cmd)
--------------------------------------------------------
to use :
NSString *NSStringFromEnumDispatch_chain_cmd(enum Dispatch_chain_cmd value);
`NSStringFromEnumDispatch_chain_cmd(chain_for_c)` returns `@"chain_for_c"`
enum Dispatch_chain_cmd enumDispatch_chain_cmdFromNSString(NSString *value);
`enumDispatch_chain_cmdFromNSString(@"chain_previous")` returns `chain_previous`
Example 2: provide conversion routines for an existing enum
also demonstrates using a settings string, and renaming the typename used in the functions.
in myfile.h
--------------------------------------------------------
#import "NSStringFromEnum.h"
#define CAEdgeAntialiasingMask_SETTINGS_PARAMS CAEdgeAntialiasingMask,mask,EdgeMask,edgeMask
interface_NSString_Enum_Converters(CAEdgeAntialiasingMask_SETTINGS_PARAMS)
--------------------------------------------------------
in myfile.m:
--------------------------------------------------------
// we can put this in the .m file as we are not defining a typedef, just the strings.
#define define_CAEdgeAntialiasingMask(enum)\
enum(kCALayerLeftEdge)\
enum(kCALayerRightEdge)\
enum(kCALayerBottomEdge)\
enum(kCALayerTopEdge)
implementation_NSString_Enum_Converters(CAEdgeAntialiasingMask_SETTINGS_PARAMS)