Lovely Lovely - 9 months ago 49
Objective-C Question

How enum can be used as string

I have CurrentType as enum in a class like following:

typedef enum {
login = 0,


Now In another ViewController,I want to use this CurrentType as parameter like as follows:

-(void)getLoginUserDetails:(NSData *)response :(CurrentType)service{

But when I write the following in method body


it gives error

How can I use this CurrentType as parameter ???

Answer Source

Concerning your subject: Enums in (Objective-)C are of an integral type like intor long. You can't assign or cast enums to strings directly, but rather have to implement your own conversion function.