title: Swift - Increment Label with Stepper in TableView Cell
body: <p>Another Swift beginner here. I simply want a Stepper in each of my TableView cells that increments a label in the same cell. </p>
  
  <p>I have found a couple of questions on this topic, but they include other elements and I haven't been able to extract the basic concept. </p>
  
  <p><a href="https://stackoverflow.com/questions/33664189/swift-stepper-action-that-changes-uitextfield-and-uilabel-within-same-cell">Swift Stepper Action that changes UITextField and UILabel within same cell</a></p>
  
  <p><a href="https://stackoverflow.com/questions/34872540/stepper-on-tableview-cell-swift">Stepper on tableview cell (swift)</a></p>
  
  <p>So far I have connected IBOutlets for my Label and Stepper, as well as an IBAction for my Stepper in my cell class.</p>
  
  <pre><code>class BuyStatsCell: UITableViewCell{
  
      //these are working fine
  
      @IBOutlet weak var category: UILabel!
      @IBOutlet weak var average: UILabel!
      @IBOutlet weak var price: UILabel!
  
  
      //Outlet for Label and Stepper - How do I make these work?
  
      @IBOutlet weak var purchaseAmount: UILabel!
      @IBOutlet weak var addSubtract: UIStepper!
  
      //Action for Stepper - And this?
  
      @IBAction func stepperAction(_ sender: UIStepper) {
          self.purchaseAmount.text = Int(sender.value).description
  
      }
  
  }
  </code></pre>
  
  <p>And I understand the concept of reusing the cell in the cellForRowAt indexPath</p>
  
  <pre><code>func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      let cell = tableView.dequeueReusableCell(withIdentifier: "BuyStatsTabCell", for: indexPath) as! BuyStatsCell
  
          cell.isUserInteractionEnabled = false
  
   //these are working 
  
          cell.category.text = categories[indexPath.row]
          cell.price.text = String(prices[indexPath.row])
          cell.average.text = String(averages[indexPath.row])
  
  //but is there something I need to add here to keep the correct Stepper and Label for each class?
  
      return cell
  }
  </code></pre>
  
  <p>One of the already asked questions includes a protocol and another function in the ViewController like this </p>
  
  <pre><code>protocol ReviewCellDelegate{
      func stepperButton(sender: ReviewTableViewCell)
  }
  
  func stepperButton(sender: ReviewTableViewCell) {
      if let indexPath = tableView.indexPathForCell(sender){
          print(indexPath)
      }
  }
  </code></pre>
  
  <p>I don't know if this is the approach I should be trying to take. I am looking for the simplest solution, but I am having trouble putting the pieces together. </p>
  
  <p>Any help is appreciated.
  Thanks. </p>