Why does the reverse() function in the Swift standard library return ReverseRandomAccessCollection? : <p>Now that I've learned Swift (to a reasonable level) I'm trying to get to grips with the standard library, but in truth it's mainly ελληνικά to me!</p>

<p>So a specific question: I have an array of strings and I can call reverse() on it.</p>

<pre><code>let arr = ["Mykonos", "Rhodes", "Naxos"].reverse()
</code></pre>

<p>Now naively I thought I'd get back a type of Array from this. (Ruby for example has a similar method that you pass an array and get back an array)</p>

<p>But arr is now actually of type</p>

<pre><code>ReverseRandomAccessCollection&lt;Array&lt;String&gt;&gt;
</code></pre>

<p>which is actually a struct, which conforms to CollectionType:</p>

<pre><code>public struct ReverseRandomAccessCollection&lt;Base : CollectionType where Base.Index : RandomAccessIndexType&gt; : _ReverseCollectionType
</code></pre>

<p>This means I can do this:</p>

<pre><code>for item in arr {
  print(item)
}
</code></pre>

<p>but I can't do</p>

<pre><code>print(arr[0])
</code></pre>

<p>Why is this designed to be this way?</p>

<p>Dictionaries in Swift also implement CollectionType, so I can do this:</p>

<pre><code>let dict = ["greek" : "swift sometimes", "notgreek" : "ruby for this example"].reverse()
</code></pre>

<p>But dictionaries are not ordered like arrays, so why can I call reverse() on dicts?</p>

<p>Bonus points if anyone can point me in the direction of where I can read up and improve my Swift stdlib foo, Ευχαριστώ!</p>
