Right now I have a table view that is an extension of a collection view.
Here is a picture of the storyboard.

The main premise of the app is similar to Apple Maps. I would like for a collectionView cell to be selected and then for the viewController to display a tableView that has all of the respected items from that category.
Here is my code for the collectionView.
class ContentViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource {
let imageArray = [UIImage(named: "image 1"), UIImage(named: "image 2"), UIImage(named: "image 3")]
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return imageArray.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CustomCell", for: indexPath) as! CustomCell
cell.mapIconImage.image = imageArray[indexPath.row]
cell.mapIconLabel.text! = imageNameArray[indexPath.row]
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
performSegue(withIdentifier: "ShowTableViewPlaces", sender: self)
}
class CustomCell: UICollectionViewCell {
@IBOutlet weak var mapIconImage: UIImageView!
@IBOutlet weak var mapIconLabel: UILabel!
}
Here is the code so far for the tableView.
import UIKit
struct PlacesInTableView {
var name: String
init(name: String) {
self.name = name
}
}
class MapItemsTableViewController: UITableViewController {
var image1InTableView = [PlacesInTableView(name: "place 1"),
PlacesInTableView(name: "place 2"),
PlacesInTableView(name: "place 3")
]
var image2InTableView = [PlacesInTableView(name: "place 1")
]
var image3InTableView = [PlacesInTableView(name: "place 1"),
PlacesInTableView(name: "place 2")
]
When a collection view is selected, I would like all of the locations in that respected category to occupy the contents of the tableview. How would I go about passing data from the collection view cell to a new tableView?