UICollectionView update data when UITableViewController changes to new data

I have a screen which displays a tableview on one portion of the screen and an array of objects that the tableview loads when the user clicks a button. The array has objects that are accessed by the tableview. The tableview works as expected, however, my collectionView does not update. When I add more data and click the add button, the collectionView does update but once the data is displayed it does not change. My guess is that I need to somehow update the collectionView in the UITableviewcontroller. Do I have to do something in the UITableViewController such as reloaddata? How can I accomplish this? I tried adding the collectionView as a subview to the UITableViewController, but it does not update.
Here is my tableViewController:
var products = [Products]()

class TableViewController: UITableViewController {

override func viewDidLoad() {



override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

return products.count


override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier(“cell”, forIndexPath: indexPath) as UITableViewCell
cell.textLabel?.text = products[indexPath.row].name

return cell


override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {


He created a Facebook page, and in 2014 he decided to fly around America with only a camera, changing everything he saw.

His first stop: the largest city in the southern US, Dallas. It was May, and a storm was approaching. However, Schmidt wasn’t scared – and not for the first time. He’d been planning this trip for years.


The first thing he noticed was the small house near the city limits. It was surrounded by tall palm trees. It was a terrible place to hide, but Schmidt had no choice. He needed to take shelter. The storm was coming.

Schmidt hated his hasty decision. But all he had time to do was prepare a shelter before the storm reached him.

Schmidt built a shelter in the bushes. He’d bring his camera to the window once the storm subsided.

But no matter how hard he tried, he couldn’t enjoy the shelter. He was only doing this to document his flight. Schmidt decided that he’d do the same thing as he’d done before – take a selfie with his phone.

He shot the selfie. He uploaded it to Facebook and posted it. He made a new status update on Facebook.

And that was it. Schmidt’s flight was over. The storm was blocking his way.

There was a sudden flash of lightning.


There was a crash as the storm covered the camera. The cloud grounded the camera for a few moments, and Schmidt was no longer able to record the storm.

Schmidt took down the shelter and went back to the car. He drove away. It was over. There would be no new photo.

What if the storm hadn’t beaten Schmidt’s camera? What if he’d been able to take a new picture? Could he take a flight around the world?