ios Swift: Passing data from tableView to view controller
<p><a href="https://i.stack.imgur.com/E7Suo.png" rel="nofollow">enter image description here</a>well this is my first time posting a  question so not to sure how it works. I am doing an assignment on swift. I am stuck at a point where I need to pass the data from tableview to viewcontroller. On my first ViewController, I have a list of data (Categories) coming from the database table and when the user clicks on any of the cell, it should go to the next viewcontroller the label becomes the heading. Please find my screen shot attached.</p>

<p>Thanks</p>

<pre><code>func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
    return values.count;
}    

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
    let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! CategoryList_TableViewCell
    let maindata = values[indexPath.row]
    cell.categoryLabel.text = maindata["NAME"] as? String
    return cell;

}
</code></pre>

<p>I tried using <code>didSelectRowAtIndexpath</code>  and <code>perparesegue</code> functions but not getting my head around.</p>

<p>can anyone can guide me. </p>

<p>Thanks a million in advance :)</p>

<p><img src="https://i.stack.imgur.com/tIwar.png" alt="screenshot of the table"></p>