xxxxxxxxxx
enum Size : Int {
case small = 10
case medium = 12
}
xxxxxxxxxx
enum TestEnum: String {
case Name = "Name"
case Gender = "Gender"
case Birth = "Birth Day"
}
let name = TestEnum(rawValue: "Name")! //Name
let gender = TestEnum(rawValue: "Gender")! //Gender
let birth = TestEnum(rawValue: "Birth Day")! //Birth
xxxxxxxxxx
enum numbers: Int {
case one = 1, two, three, four
}
let num = numbers.one
print(num.rawValue) // Output: 1
xxxxxxxxxx
enum Size : Int {
case small = 10
case medium = 12
case large = 14
}
// access raw value of python case
var result = Size.small.rawValue
print(result)