title: Passing data of table view (row select) to view controller
body: <p>mi problem is this: I want to select the first, second... row and the view controller must show the information according to the row selected(label, images, etc), I trying a lot of thing but, not work.</p>
  
  <p>I use protocol and this:</p>
  
  <pre><code>func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return 4
  }
  
  func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
  
      let cell = self.tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! CustomCellF
  
  
      cell.l2.text = hname[indexPath.row]
      cell.l1.text = prename[indexPath.row]
      cell.img1.image = imgs[indexPath.row]
  
      return cell
  }
  
  func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath){
      let selectedH = self.nin2[(indexPath as NSIndexPath).row]
      self.delegate?.HabiSelected(selectedH)
  }
  </code></pre>
  
  <p>Thanks</p>
  
  <p><a href="https://i.stack.imgur.com/Fydsv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Fydsv.png" alt="enter image description here"></a></p>