title: hiding tableview cells when the data fetched is nil thus reducing cell size
body: <p>I have a tableview inside a collection view cell.  The tableview displays data which has been fetched.  Although, the data fetched is sometimes nil and ends up looking like this:<a href="https://i.stack.imgur.com/37mKW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/37mKW.png" alt="enter image description here"></a></p>
  
  <p>In this case the company has no facebook name.  At the moment I'm hard coding the tableview cell count: </p>
  
  <pre><code>var arrayForContactList : NSMutableArray = []
  override init(frame: CGRect) {
      super.init(frame: frame)
      setupViews()
      setupContactList()
  }
  
  func setupContactList() {
  
      if let phoneNumber = selectedCompany.phoneNumber {
  
          let dictionaryForContact = NSDictionary()
          dictionaryForContact.setValue("Phone", forKey: "Title")
          dictionaryForContact.setValue(phoneNumber, forKey: "Detail")
          arrayForContactList.addObject(dictionaryForContact)
      }
      // And the rest...
  
      self.tableView.reloadData()
  }
  
  func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return 6
  }
  </code></pre>
  
  <p>as for displaying the data in the tableview:</p>
  
  <pre><code>let contactArray = ["Phone", "Website", "Email", "Twitter", "Facebook", "Instagram"]
  
  func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
  
      let cell = tableView.dequeueReusableCellWithIdentifier("CellID") as! ContactCell
  
      cell.contactLabel.text = arrayForContactList[indexPath.row].objectForKey("Title") as? String
      cell.contactButton.setTitle(arrayForContactList[indexPath.row].objectForKey("Detail") as? String, forState: .Normal)
  
      return cell
  }
  </code></pre>
  
  <p>What I want to do reduce the size of the tableview by deleting cell(s) if the data = nil. Then, on top of that I want to decrease the size of the collectionview cell that the tableview sits in if cells from the tableview have been removed.</p>