title: How to iterate through Dictionary of Dictionary Values in UITableViewCell?
body: <p>This is my first post and I hope its a great question because iv been stuck on this for days. (Literally searched every related question and found nothing that I could add up for a solution.)</p>
  
  <p>Basically I'm building a pure Swift application. My problem is that I cant figure out how to place each dictionary values into each UITableCell that is created.</p>
  
  <p>Also the <code>JSON</code> response from the <code>GET</code> creates a <strong><code>NSCFDictionary</code></strong> type.</p>
  
  <p>UITableViewCell Properties</p>
  
  <ul>
  <li>UILabel - Holds the Offer "name"</li>
  <li>UI Label #2 - Holds Offer "description"</li>
  <li>UIImage - Holds the Offer "thumb_url"</li>
  </ul>
  
  <p>So basically I need to store each <code>offer</code> object's <code>(name, description, thumb_url)</code> in every <code>UITableViewCell</code> that the <code>ViewController</code> creates.</p>
  
  <p><code>GET Request</code></p>
  
  <pre><code>import UIKit
  
  class freeIAPCell: UITableViewCell {
  
      @IBOutlet weak var aName: UILabel!
  
      @IBOutlet weak var aDescription: UILabel!
  
      @IBOutlet weak var aImage: UIImageView!
  
  
  
  }
  
  class FreeIAPViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
  
  
      // Everbadge Request
  
      var apiURL = "apiurlhere"
  
      var parsedArray: [[String:String]] = []
  
      func queryEB() {
  
          // Query  DB Here
  
          // Store the API url in a NSURL Object
          let nsURL = NSURL(string: apiURL)
  
          let request = NSMutableURLRequest(URL: nsURL!)
  
          request.HTTPMethod = "GET"
  
          // Execute HTTP Request
  
          let task = NSURLSession.sharedSession().dataTaskWithURL(nsURL!) {
              data, response, error in
  
              if error != nil {
                  print("Error = \(error)")
                  return
              }
  
              let responseString = NSString(data: data!, encoding: NSUTF8StringEncoding)
  
              do {
                  let json = try NSJSONSerialization.JSONObjectWithData(data!, options: .AllowFragments) as! NSDictionary
  
                  print(json.isKindOfClass(NSDictionary)) // true
  
                  let data = json.objectForKey("data") as! NSDictionary
                  //print(data)
                  let m = data.objectForKey("offers") as! NSArray
                  print(m)
                  print(m.valueForKeyPath("name"))
                  self.parsedArray = m as! [[String : String]]
  
  
              } catch {
                  print("THERE WAS AN ERROR PARSING JSON FOR EVERBADGE")
              }
  
  
          }
          task.resume()
  
      }
  
  
      override func viewDidLoad() {
          super.viewDidLoad()
          queryEB()
  
  
  
  
      }
  
      override func viewWillAppear(animated: Bool) {
          super.viewWillAppear(true)
  
  
      }
  
      // MARK: UITableView method implementation
  
      func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int {
          return 1
      }
  
  
      func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
          return 4
      }
  
      func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -&gt; CGFloat {
          return 100
      }
  
      func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
  
  
      }
  
      func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
          let cell = tableView.dequeueReusableCellWithIdentifier("freeAppCell", forIndexPath: indexPath) as! freeIAPCell
  
          let obj = parsedArray[indexPath.row] // fatal error: Index out of range
          cell.aName.text = obj["name"]
          return cell
      }
  
  
  }
  </code></pre>
  
  <p><code>API Request Data Structure</code> (print(m))</p>
  
  <pre><code>( 
                {
                  "name" = "Mate";
                  id = 23941;
                  description = "10-20 word description goes here"
                  "url" = "google.com
                  "ver" = "0.12"
                  price = "0.17"
                  "public_name" = "Good Ole Mate"
                  "thumb_url" = "http://google.com/mate.jpg
            };
             {
                  "name" = "Mate";
                  id = 23941;
                  description = "10-20 word description goes here"
                  "url" = "google.com
                  "ver" = "0.12"
                  price = "0.17"
                  "public_name" = "Good Ole Mate"
                  "thumb_url" = "http://google.com/mate.jpg
            };
            {
                  "name" = "Mate";
                  id = 23941;
                  description = "10-20 word description goes here"
                  "url" = "google.com
                  "ver" = "0.12"
                  price = "0.17"
                  "public_name" = "Good Ole Mate"
                  "thumb_url" = "http://google.com/mate.jpg
            };
             {
                  "name" = "Mate";
                  id = 23941;
                  description = "10-20 word description goes here"
                  "url" = "google.com
                  "ver" = "0.12"
                  price = "0.17"
                  "public_name" = "Good Ole Mate"
                  "thumb_url" = "http://google.com/mate.jpg
            };
             {
                  "name" = "Mate";
                  id = 23941;
                  description = "10-20 word description goes here"
                  "url" = "google.com
                  "ver" = "0.12"
                  price = "0.17"
                  "public_name" = "Good Ole Mate"
                  "thumb_url" = "http://google.com/mate.jpg
            };
  );
  </code></pre>