title: How to Implement hash(into:) from hashValue in Swift?
body: <p>I don't quite have an idea on what to do with the deprecation warning from the compiler to not use <code>hashValue</code> and instead implement <code>hash(into:)</code>.</p>
  
  <blockquote>
    <p>'Hashable.hashValue' is deprecated as a protocol requirement; conform
    type 'MenuItem' to 'Hashable' by implementing 'hash(into:)' instead</p>
  </blockquote>
  
  <p>The answer from <a href="https://stackoverflow.com/questions/55395207/swift-hashable-hashvalue-is-deprecated-as-a-protocol-requirement">Swift: &#39;Hashable.hashValue&#39; is deprecated as a protocol requirement;</a> has this example:</p>
  
  <pre><code>func hash(into hasher: inout Hasher) {
      switch self {
      case .mention: hasher.combine(-1)
      case .hashtag: hasher.combine(-2)
      case .url: hasher.combine(-3)
      case .custom(let regex): hasher.combine(regex) // assuming regex is a string, that already conforms to hashable
      }
  }
  </code></pre>
  
  <p>And I do have this struct, to customise <code>PagingItem</code> of Parchment (<a href="https://github.com/rechsteiner/Parchment" rel="noreferrer">https://github.com/rechsteiner/Parchment</a>).</p>
  
  <pre><code>import Foundation
  
  /// The PagingItem for Menus.
  struct MenuItem: PagingItem, Hashable, Comparable {
      let index: Int
      let title: String
      let menus: Menus
  
      var hashValue: Int {
          return index.hashValue &amp;+ title.hashValue
      }
  
      func hash(into hasher: inout Hasher) {
          // Help here?
      }
  
      static func ==(lhs: MenuItem, rhs: MenuItem) -&gt; Bool {
          return lhs.index == rhs.index &amp;&amp; lhs.title == rhs.title
      }
  
      static func &lt;(lhs: MenuItem, rhs: MenuItem) -&gt; Bool {
          return lhs.index &lt; rhs.index
      }
  }
  </code></pre>