title: Search Array of Dictionaries for Value in Swift
body: <p>I'm new to Swift and taking a class to learn iOS programming. I find myself stumped on how to search in an array of dictionaries for a string value and dump the string value into an array. This is taken from my Xcode playground.</p>
  
  <p>I'm trying to figure out how to:
  1) search through an array of dictionaries
  2) dump the results of the search into an array (which I've created)</p>
  
  <p>These are the character dictionaries.</p>
  
  <pre><code>let worf = [
      "name": "Worf",
      "rank": "lieutenant",
      "information": "son of Mogh, slayer of Gowron",
      "favorite drink": "prune juice",
      "quote" : "Today is a good day to die."]
  
  let picard = [
      "name": "Jean-Luc Picard",
      "rank": "captain",
      "information": "Captain of the USS Enterprise",
      "favorite drink": "tea, Earl Grey, hot"]
  </code></pre>
  
  <p>This is an array of the character dictionaries listed above.</p>
  
  <pre><code>let characters = [worf, picard]
  </code></pre>
  
  <p>This is the function I'm trying to write.</p>
  
  <pre><code>func favoriteDrinksArrayForCharacters(characters:Array&lt;Dictionary&lt;String, String&gt;&gt;) -&gt; Array&lt;String&gt; {
      // create an array of Strings to dump in favorite drink strings
      var favoriteDrinkArray = [String]()
  
      for character in characters {
          // look up favorite drink
  
          // add favorite drink to favoriteDrinkArray
      }
  
      return favoriteDrinkArray
  }
  
  let favoriteDrinks = favoriteDrinksArrayForCharacters(characters)
  
  favoriteDrinks
  </code></pre>
  
  <p>I would be grateful for any assistance on how to move forward on this. I've dug around for examples, but I'm coming up short finding one that's applicable to what I'm trying to do here.</p>