Is there a way to assign values to enums during runtime in objective c?
I have several enums and want each of the enum to have certain value.
The values could be read from a xml file. Is there a way to do this?
Is there a way to assign values to enums during runtime in objective c?
Share
Unfortunatley, @Binyamin is correct, you cannot do this with an enum. For this reason, I usually do the following in my projects:
This also has the advantage of being able to iterate through the values, which is not possible with a normal enum:
All in all, this is my preferred way to do enums in C.