swift enumeration code example
Example 1: enum raw value swift
enum numbers: Int {
case one = 1, two, three, four
}
let num = numbers.one
print(num.rawValue) // Output: 1
Example 2: swift enum
enum Planet {
case mercury, venus, earth, mars, jupiter, saturn, uranus, neptune
}