Taking an enum name instead of it's value

This won’t work if you declare enums with custom values:

enum EnumName {YES = -5, NO = 10, NOT_SURE = 100}

The more universal approach would be to query dictionary for the key:

var text_representation: String = EnumName.find_key(particular_value)
5 Likes