title: Looping through results with "for in" loop to build separate array
body: <p>SWIFT COREDATA 
  I'm having trouble setting up a for - in loop to collect results from a fetch. No problem getting individual results by fetch results[index] but inserting  for-in loop gives me an error (type mismatch) or (type does not contain member in Generator). I want to use the fetch results to populate a separate array.</p>
  
  <p>Any help you can provide is greatly appreciated.</p>
  
  <p>excerpt from code:</p>
  
  <pre><code>import Foundation
  import UIKit
  import CoreData
  // globaals
  var pickResult:String?
  var pickMultiresult:[AnyObject]?
  // add var
  var fullnameMulti:[String]?  // array of full names
  var i:Int = 0
  // end new var
  class ClientPicker:UIViewController, UIPickerViewDelegate {
      // connections
  
      @IBOutlet weak var singleResult: UITextField!
      let managedObjectContext = (UIApplication.sharedApplication().delegate as! AppDelegate).managedObjectContext
      @IBOutlet weak var firstname: UITextField!
      @IBOutlet weak var status: UILabel!
      var lastname:String = ""
      var phone:String = ""
      var email:String = ""
  
      override func viewDidLoad() {
          super.viewDidLoad()
          // Do any additional setup after loading the view, typically from a nib.
   }
   // MARK: ********** block 2 --- findClient ****
      @IBAction func findClient(sender: AnyObject) {
          let entityDescription = NSEntityDescription.entityForName("Contacts", inManagedObjectContext: managedObjectContext)
          let request = NSFetchRequest()
          request.entity = entityDescription
          let pred = NSPredicate(format: "(firstname = %@)", firstname.text!)
          request.predicate = pred
  
          do {
              var results = try managedObjectContext.executeFetchRequest(request)
              multiresult = results
              if results.count &gt; 0 {
  //                let match = results[0] as! NSManagedObject  NOTE: these return correct data for indices 0 and 3
  //                let match = results[3] as! NSManagedObject  NOTE: these return correct data for indices 0 and 3 
                  status.text = "There are  \(results.count) people named \(firstname.text!)"
              } else {
                  status.text = "No Match"
              }
          } catch let error as NSError {
              status.text = error.localizedFailureReason
          }
  
  
  
  // for in loop to populate firstnameMulti array
          i = 0
      for i in results{
          var p = i
          let match = results[p] as! NSManagedObject
  
                  /* the following code returns correct fullname when used outside of for loop
                  but error when I use the for loop  */
                  firstname.text = match.valueForKey("firstname") as? String
                  /*****************  concatenate first and last names  ********/
                  let first = match.valueForKey("firstname") as? String
                  let last = match.valueForKey("lastname") as? String
                  // concatenate
                  var fullname:String = ""
                  fullname = "\(first!) \(last!)"
                  singleResult.text = fullname       
          }
  }
  
  */  error: value of type string has no member in Generator */
  </code></pre>