Now I need a convenient way to get the name of enumeration itself ? Here is an example.
enum SimpleEnum {
case firstCase
case secondCase
case thirdCase
}
let simpleEnum: SimpleEnum = .firstCase
print("\(simpleEnum)") // return the "firstCase", but I want "SimpleEnum"
I know the following code would work.
enum SimpleEnum: CustomStringConvertible {
case firstCase
case secondCase
case thirdCase
var description: String { return "SimpleEnum" }
}
let simpleEnum: SimpleEnum = .firstCase
print("\(simpleEnum)") // Ok, it return "SimpleEnum"
However, I just want an universal way instead of typing "SimpleEnum" for each enum.