title: " Duplicate keys of type ... were found in a Dictionary " when there is no Dictionary?
body: <p>I'm quite new to Swift and I just encountered an error I don't find a solution for. I'm currently working on a game (Boggle, for the curious) and I want to update the list of words that the algorithm has found.</p>
  <p>I created a struct to hold each word and the points it scores :</p>
  <pre><code>struct ScoredWord: Comparable, Identifiable{
  let word: String
  var points: Int = 0
  let id: UUID
  
  init(word: String){
      self.id = UUID()
      self.word = word
      self.points = self.defineScore(word: word)
  }
  
  static func &lt; (lhs: ScoredWord, rhs: ScoredWord) -&gt; Bool {}
  
  static func == (lhs: ScoredWord, rhs: ScoredWord) -&gt; Bool {}
  
  func hash(into hasher: inout Hasher) {
  
  private func defineScore(word: String) -&gt; Int{}
  </code></pre>
  <p>(I removed the content of the func for it's useless to you)</p>
  <p>Once the algorithm is done, I have simple loop that created a struct for each word found and stores it in the array that is @Published for display</p>
  <pre><code>let foundWords = solver.findValidWords()
      
  for found in foundWords {
      wordList.append(ScoredWord(word: found))
  }
  </code></pre>
  <p>The array is used in my view this way:</p>
  <pre><code> List(wordListViewModel.wordList, id: \.self) { // 1 Word list
       Text( $0.word )
       Spacer()
       Text(&quot;\( $0.points )&quot;)
   }
  </code></pre>
  <p>The error I get when I run all of this is:</p>
  <pre><code>Fatal error: Duplicate keys of type 'ScoredWord' were found in a Dictionary. 
  This usually means either that the type violates Hashable's requirements, or
  that members of such a dictionary were mutated after insertion.
  </code></pre>
  <p>I found <a href="https://stackoverflow.com/questions/62032654/fatal-error-duplicate-keys-of-type-geocoded-placemark-were-found-in-a-diction">this post</a> about the same error where a comment states that the error would come from the list not being displayed fast enough and id getting mixed up, but nothing about how to fix it...</p>
  <p>Any idea?</p>