Elegant way of turning Dictionary or Generator or Sequence in Swift into an Array? <p>Is there an elegant way to convert Dictionary (or Sequence or Generator) into an Array. I know I can convert it by looping through the sequence as follows.</p> <pre><code>var d = ["foo" : 1, "bar" : 2] var g: DictionaryGenerator&lt;String, Int&gt; = d.generate() var a = Array&lt;(String, Int)&gt;() while let item = g.next() { a += item } </code></pre> <p>I am hoping there is something similar to Python's easy conversion:</p> <pre><code>&gt;&gt;&gt; q = range(10) &gt;&gt;&gt; i = iter(q) &gt;&gt;&gt; i &lt;listiterator object at 0x1082b2090&gt; &gt;&gt;&gt; z = list(i) &gt;&gt;&gt; z [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] &gt;&gt;&gt; </code></pre>