Is there a way to refer to rawValue as a different named member in Swift? -
in swift, if
enum number: int { case one, two, three, four, 5 } var 5 = number.five print( five.rawvalue )
is possible refer raw value using name other built-in rawvalue, e.g. uniquely descriptive case @ hand, such numberint or that, e.g.
print( five.numberint )
?
enum number: int { case one, two, three, four, 5 var numberint : int { return self.rawvalue } } var 5 = number.five print(five.rawvalue) // 4 print(five.numberint) // 4
Comments
Post a Comment