How to understand this code?
> enum TextAlignment: Int{ > case left = 1 > case right = 2 > case center = 20 > } > TextAlignment.left.rawValue > let myRawValue = 20 > if let myAlignment = TextAlignment(rawValue: myRawValue){ > print("successfully converted \(myRawValue) into a TextAlignment") > }else{ > print("\(myRawValue) has no corresponding TextAlignment case") > }
And yes we successfully converted 20 into TextAlignment but i dont understand why we need this?
What do we get useful with this code?