I am running this code in both xcode 9.3 and xcode 10 beta 3 playground
import Foundation
public protocol EnumCollection: Hashable {
static func cases()
If you use hashValue of an enum to determine case values (position or id), it's a wrong approach since it doesn't guarantee to return sequential int values, 0,1,2... It is not working anymore from swift 4.2
For example, If you use an enum like this :
enum AlertResultType {
case ok, cancel
}
hashValue of this enum might return a large int value instead of 0 (ok) and 1 (cancel).
So you may need to declare the enum type more precisely and use rowValue. For example
enum AlertResultType : Int {
case ok = 0, cancel = 1
}