title: Enum Identifiable in SwiftUI
body: <p>I am trying to conform my enum Sheets to Identifiable. This means, I must implement the id property and return it.</p>
  <pre><code>struct Product: Hashable {
      let name: String
      let price: Double
  }
  
  enum Sheets: Identifiable {
      case add
      case edit(Product)
  
      var id: Int {
         hashValue
       }
  }
  </code></pre>
  <p>The above implementation does not work and an error says that hashValue is undefined. The other implementation I used is as follows:</p>
  <pre><code>enum Sheets: Identifiable {
      case add
      case edit(Product)
      
      var id: Int {
          switch self {
              case .add:
                  return 1
              case .edit(_):
                  return 2
          }
      }
      
  }
  </code></pre>
  <p>This does return a stable identity. Is this the recommended way to solve the problem of creating a stable identity for my enum cases.</p>