title: How to make an enum conform to Hashable with the API available in Xcode 10?
body: <p>In my Swift 4.2.1 code I have this enumeration:</p>
  
  <pre><code>enum MyEnum {
  
      case caseOne(Int)
      case caseTwo(String)
      case caseThree
  }
  </code></pre>
  
  <p>It conforms to <code>Equatable</code>:</p>
  
  <pre><code>extension MyEnum: Equatable {
  
      static func == (lhs: MyEnum, rhs: MyEnum) -&gt; Bool {
  
          switch (lhs, rhs) {
          case (.caseOne, .caseOne), (.caseTwo, .caseTwo), (.caseThree, .caseThree):
              return true
          default:
              return false
          }
      }
  }
  </code></pre>
  
  <p>I need to make it conform to <code>Hashable</code>, that's why I added an extension:</p>
  
  <pre><code>extension MyEnum: Hashable {
  
      var hashValue: Int {
  
          switch self {
          case .caseOne:
              return 1
          case .caseTwo:
              return 2
          case .caseThree:
              return 3
          }
      }
  }
  </code></pre>
  
  <p>Now I want to migrate to the new API available in Xcode 10. I removed my implementation of <code>hashValue</code> and added the implementation of <code>hash(into:)</code>:</p>
  
  <pre><code>extension MyEnum: Hashable {
  
      func hash(into hasher: inout Hasher) {
  
          switch self {
          case .caseOne:
              hasher.combine(1)
          case .caseTwo:
              hasher.combine(2)
          case .caseThree:
              hasher.combine(3)
          }
      }
  }
  </code></pre>
  
  <p>Could you please tell me if I switched correctly to the new API? I use this test, it prints <code>true</code> twice if everything works fine:</p>
  
  <pre><code>var testDictionary = [MyEnum: Int]()
  testDictionary[.caseOne(100)] = 100
  testDictionary[.caseOne(1000)] = 1000
  testDictionary[.caseTwo("100")] = 100
  testDictionary[.caseTwo("1000")] = 1000
  let countCaseOne = testDictionary.reduce(0) {
      if case .caseOne = $1.key {
          return $0 + 1
      }
      return $0
  } == 1
  print(countCaseOne) // true
  let countCaseTwo = testDictionary.reduce(0) {
      if case .caseTwo = $1.key {
          return $0 + 1
      }
      return $0
  } == 1
  print(countCaseTwo) // true
  </code></pre>