title: SwiftUI iterating through dictionary with ForEach
body: <p>Is there a way to iterate through a <code>Dictionary</code> in a <code>ForEach</code> loop? Xcode says</p>
  
  <blockquote>
    <p>Generic struct 'ForEach' requires that '[String : Int]' conform to 'RandomAccessCollection'</p>
  </blockquote>
  
  <p>so is there a way to make Swift Dictionaries conform to <code>RandomAccessCollection</code>, or is that not possible because Dictionaries are unordered?</p>
  
  <p>One thing I've tried is iterating the dictionary's keys:</p>
  
  <pre><code>let dict: [String: Int] = ["test1": 1, "test2": 2, "test3": 3]
  ...
  ForEach(dict.keys) {...}
  </code></pre>
  
  <p>But <code>keys</code> is not an array of <code>String</code>s, it's type is <code>Dictionary&lt;String, Int&gt;.Keys</code> (not sure when that was changed). I know I could write a helper function that takes in a dictionary and returns an array of the keys, and then I could iterate that array, but is there not a built-in way to do it, or a way that's more elegant? Could I extend <code>Dictionary</code> and make it conform to <code>RandomAccessCollection</code> or something?</p>