I got a curious about how compiler determines a value's rawValue. First, I give you an example code:
enum Rank: Int{
case Tom
case Jane
case Steve, Tim
}
In this situation, Rank.Tom.rawValue
is 0, also Rank.Jane.rawValue
is equal to 1 (increment as 1). It means, compiler determines rawValue automatically starting from 0, if data type is Int.