If you want to map enum values ββto integers, you must do this directly with raw values. For example (from Swift Programming Language: Enumerations ):
enum Planet: Int { case Mercury = 1, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune } let possiblePlanet = Planet(rawValue: 7)
I donβt think that there is documentation promising that enum hashValue is anything special (if you have a link, Iβm very interested). In the absence of this, you must be explicit in your assignment of raw values.
Rob napier
source share