title: Setting UIPicker view to selected string - Swift
body: <p>Is there a way to set a UIPicker view to a selected string? My picker view is populated from a database and contains a set of names. I want to set the value of the view to a selected name when it is populated. The row number will change every time. Is it possible to set the value to match a string?</p>
  
  <p>Below is my attempt based on the comments: </p>
  
  <pre><code>            var i : Int = 0
          while (nameArray[i] != assetArray[0].Owner)
          {
              i=i+1
          }
          scroll_owners.selectRow(i, inComponent: i, animated: true)
  </code></pre>
  
  <p>This causes the code to break when trying to load it due to Index out of bounds.</p>