title: How can I group TableView items from a dictionary in swift?
body: <p>Lets consider this example: </p>
  
  <pre><code>import UIKit
  class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { 
      @IBOutlet weak var tableView: UITableView!
  
      var names = ["Vegetables": ["Tomato", "Potato", "Lettuce"], "Fruits": ["Apple", "Banana"]]
  
          func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell{
  
          let cell: UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier:"test")
  
      return cell
      }
  
      func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int{
      return ???
      }
      func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int{      
      return names.count
      }
  
      func sectionIndexTitlesForTableView(tableView: UITableView) -&gt; [AnyObject]!{
  
      return ???
      }
  
      func tableView(tableView: UITableView,
          titleForHeaderInSection section: Int) -&gt; String?{        
      return ????
      }
  }
  </code></pre>
  
  <p>let's assume that we need that the keys (fruits and vegetables) of the dictionary are the number of sections, plus they will be the titles of the sections. The items of the keys (eg apples and banana) will be the rows of each section. How can I implement this in my code? I know it might be easy but I couldn't figure it out my self.</p>