How to get the name of an enumeration case by its raw value in Swift 4?
问题 Using Xcode 9.4.1 and Swift 4.1 Having an enumeration with multiple cases from type Int, how can I print the case name by its rawValue? public enum TestEnum : UInt16{ case ONE = 0x6E71 case TWO = 0x0002 case THREE = 0x0000 } I am accessing the Enum by the rawValue: print("\nCommand Type = 0x" + String(format:"%02X", someObject.getTestEnum.rawValue)) /*this prints: Command Type = 0x6E71 if the given Integer value from someObject.TestEnum is 28273*/ Now I additionally want to print "ONE" after