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

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -