title: How to Load a Dictionary into a UIPickerView
body: <p>How can I load data from a dictionary into a PickerView in Swift? </p>
  
  <p>I have dictionary with a <code>String</code> key (States) and a <code>Double</code> value (taxes) and what I want to do is be able to set the keys as the <code>titleForRow</code> of the UIPickerView and show the value of the selected <code>key</code> in a <code>textField</code>.</p>
  
  <pre><code>// Ideal Dictionary
  private var states:[String:Double] = ["Alabama":6.000, "Illinois":7.000, "Oregon":8.000, "Wisconsin":9.000]
  </code></pre>
  
  <p>I was able to do what I described above using two arrays, one for the states and one for the taxes but I refuse to think that loading from a dictionary is not possible.</p>
  
  <p>Here is what I currently have that works but using two arrays.</p>
  
  <pre><code>// Arrays
  private var stateName = ["Alabama", "Illinois", "Oregon", "Wisconsin"]
  private var stateTax = ["6.000", "7.000", "8.000", "9.000"]
  
  func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -&gt; Int {
      return stateName.count
  }
  func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
      inputTaxRate.text = stateTax[row]
  }
  func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -&gt; String? {
      return stateName[row]
  }
  </code></pre>
  
  <p>Any suggestion to improve the above code?</p>