title: How can i create dynamic uicollectionview within a dynamic uitableview
body: <p>I'm new to swift as well as iOS development.I wanna create tableview containing collection view in swift. that i'm able to do so far but my problem arises when the number of items in collection view and no. of rows in tableview depends on the json data i'm retrieving. I'm not able to program number of items in collection view. I'm using custom cell classes for tableviewcell as well as collectionviewcell. How can i change data in collectionview cell of table each table row differently.code for collection view delegates</p>
  
  <pre><code>func collectionView(collectionView: UICollectionView,
      numberOfItemsInSection section: Int) -&gt; Int {
  
          return array_servicelist.objectAtIndex(something).valueForKey("subCategoryList")!.count
  }
  
  func collectionView(collectionView: UICollectionView,
      cellForItemAtIndexPath indexPath: NSIndexPath) -&gt; UICollectionViewCell {
  
          let cell = collectionView.dequeueReusableCellWithReuseIdentifier("collectioncell",
              forIndexPath: indexPath) as! ServiceCollectionViewCell
  
          let str :String = "\(array_servicelist.objectAtIndex(indexPath.section).valueForKey("subCategoryList")!.objectAtIndex(indexPath.item).valueForKey("phoneImageUrl") as! String)"
          cell.serviceImage.image = UIImage(data: NSData(contentsOfURL: NSURL(string: str)!)!)
          cell.serviceName.text = "\(array_servicelist.objectAtIndex(indexPath.section).valueForKey("subCategoryList")!.objectAtIndex(indexPath.item).valueForKey("categoryName") as! String)"
  
          return cell
  }
  </code></pre>
  
  <p>code for tableview delegates</p>
  
  <pre><code>func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int {
      return array_servicelist.count
  }
  
  func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
      let cell = self.tableView.dequeueReusableCellWithIdentifier("tablecell", forIndexPath: indexPath)
  
      return cell
  }
  
   func tableView(tableView: UITableView,
      willDisplayCell cell: UITableViewCell,
      forRowAtIndexPath indexPath: NSIndexPath) {
  
          guard let tableViewCell = cell as? ServiceTableViewCell else { return }
  
          tableViewCell.setCollectionViewDataSourceDelegate(self, forRow: indexPath.row)
  
  }
  func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return 1
  }
  </code></pre>