title: Access label in a cell in Swift
body: <p>I have made a custom cell in a table view. There are some buttons and labels in a cell. I'm making a delegate method and call it on the action of the button. The button is also in a cell. Now i'm trying that whenever user press button the label text should increment by one. I'm trying to access the cell label outside the cellForRow delegate method but fail. How can i get the label in a cell outside the cellForRow delegate method in my button action? I have tried some code,
  this is in my cell class,</p>
  
  <pre><code>protocol cartDelegate {
  func addTapped()
  func minusTapped()
  }
  
  var delegate : cartDelegate?
   @IBAction func addBtnTapped(_ sender: Any) {
  
      delegate?.addTapped()
  }
  
  @IBAction func minusBtnTapped(_ sender: Any) {
  
      delegate?.minusTapped()
  }
  </code></pre>
  
  <p>This is in my view controller class,</p>
  
  <pre><code>extension CartViewController : cartDelegate{
  
  func addTapped() {
  
      total += 1
      print(total)
  
  }
  
  func minusTapped() {
      total -= 1
      print(total)
  }
  </code></pre>
  
  <p>}
   this is cellForRow method,</p>
  
  <pre><code>func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell
  
  {
      let cell = tableView.dequeueReusableCell(withIdentifier: "cell") as! CartTableViewCell
  
      cell.dishTitleLbl.text = nameArray[indexPath.row]
      cell.priceLbl.text = priceArray[indexPath.row]
      price = Int(cell.priceLbl.text!)!
      print(price)
      cell.dishDetailLbl.text = "MANGO,Apple,Orange"
      print(cell.dishDetailLbl.text)
      total = Int(cell.totalLbl.text!)!
  
      cell.selectionStyle = .none
      cell.backgroundColor = UIColor.clear
      cell.delegate = self
      return cell
  }
  </code></pre>
  
  <p>I want to access priceLbl in my addTapped and minusTapped functions.</p>