Different in Xcode 10
Hello everyone, Xcode 10 has been officially released, There are couple different behavior between Xcode 9, for example enum’s hashValue and rawValue as following. In Xcode 9 all enums get a hashValue which is basically like an Index to the order in which the enums were declared, but in Xcode 10 the hashValue is not index of order anymore.
Xcode 10.0 enum:
//Xcode 10
enum myEnum: Int {
case apple
case banana
}print(myEnum.apple.hashValue) //6301819286870297653
print(myEnum.banana.rawValue) //0print(myEnum.banana.hashValue) //4559753696474043376
print(myEnum.banana.rawValue) //1
Xcode 9.4.1 enum:
Xcode 9.4.1
enum myEnum: Int {
case apple
case banana
}print(myEnum.apple.hashValue) //0
print(myEnum.banana.rawValue) //1print(myEnum.apple.hashValue) //0
print(myEnum.banana.rawValue) //1