title: Ordered map in Swift
body: <p>Is there any <em>built-in</em> way to create an ordered map in Swift 2? Arrays <code>[T]</code> are sorted by the order that objects are appended to it, but dictionaries <code>[K : V]</code> aren't ordered.</p>
  
  <p>For example</p>
  
  <pre><code>var myArray: [String] = []
  myArray.append("val1")
  myArray.append("val2")
  myArray.append("val3")
  
  //will always print "val1, val2, val3"
  print(myArray)
  
  
  var myDictionary: [String : String] = [:]
  myDictionary["key1"] = "val1"
  myDictionary["key2"] = "val2"
  myDictionary["key3"] = "val3"
  
  //Will print "[key1: val1, key3: val3, key2: val2]"
  //instead of "[key1: val1, key2: val2, key3: val3]"
  print(myDictionary)
  </code></pre>
  
  <p>Are there any built-in ways to create an ordered <code>key : value</code> map that is ordered in the same way that an array is, or will I have to create my own class? </p>
  
  <p>I would like to avoid creating my own class if at all possible, because whatever is included by Swift would most likely be more efficient.</p>