title: Cannot convert value of type 'UUID' to expected argument type 'KeyPath<Item, ID>' in SwiftUI
body: <p>I'm implementing my own custom Grid in SwiftUI. I'm using generics to lay out an array of given items in a Grid fashion. I want them to be animated so I need to specify an id for ForEach within Grid implementation. How to specify id since items are generics.</p>
  <p>I thought of using UUID I got the following error</p>
  <blockquote>
  <p>Cannot convert the value of type 'UUID' to expected argument type
  'KeyPath&lt;Item, ID&gt;'</p>
  </blockquote>
  <p>Also, I tried <code>id: \.self</code> - I'm getting following error:</p>
  <blockquote>
  <p>Generic struct 'ForEach' requires that 'Item' conform to 'Hashable'</p>
  </blockquote>
  <p>Here is my Grid code:</p>
  <pre><code>struct Grid&lt;Item, ItemView&gt; : View where Item : Identifiable, ItemView : View{
      private var items : Array&lt;Item&gt;
      private var viewForItem : (Item) -&gt; ItemView
      
      init(_ items: Array&lt;Item&gt;, viewForItem: @escaping (Item) -&gt; ItemView) {
          self.items = items
          self.viewForItem = viewForItem
      }
      
      func getLayout(itemsCount: Int, size: CGSize) -&gt; GridLayout {
          GridLayout(itemCount: itemsCount, in: size)
      }
      
      var body: some View {
          GeometryReader { geometry in
              
              ForEach(self.items, id: \.self) { item in
                 self.viewForItem(item)
                  .frame(width: self.getLayout(itemsCount: self.items.count, size: geometry.size).itemSize.width,
                         height: self.getLayout(itemsCount: self.items.count, size: geometry.size).itemSize.height)
                          .position(self.getLayout(itemsCount: self.items.count, size: geometry.size)
                          .location(ofItemAt: self.items.firstIndex(of: item)!))
              }
          }
          
      }
  }
  </code></pre>
  <p>Here is my model:</p>
  <pre><code>struct SetGame {
      var deck : Array&lt;SetCard&gt; = []
      var playingTwelveDeck : Array&lt;SetCard&gt; = []  
  }
  </code></pre>
  <pre><code>struct SetCard : Identifiable, Hashable {
      var color : ColorValue
      var shapeName : ShapeName
      var shading : Shadings
      var count : Int
      var isSelected = false
      var isMatched = false
      var position : Int
      var isSelectedAnimationToggle : Bool
      var id = UUID()
  }
  </code></pre>
  <p>Im using <code>SetGame.SetCard</code> as my item in Grid.</p>