Duplicate data on different cells when scrolling tableview

Hi,

I have a dynamic table view. Each cell have a stepper and UILabel. When I press the stepper control on a some cells and scroll, other cells are getting impacted and values of some cells that I filled gets remove too. I guess it's the consequence of using dequeueReusableCell from the cellForRowAt indexPath method. I found that i had to use the prepareForReuse method inside my  UITableViewCell class, however I am still facing same issue. Any recommendation how to fix it.

Code Block
class PlayerAssistContributionCell: UITableViewCell {
  @IBOutlet weak var playerName: UILabel!
    @IBOutlet weak var playerRating: UILabel!
    @IBOutlet weak var stepperLabel: UILabel!
    @IBOutlet weak var stepper: UIStepper!
override func prepareForReuse() {
           super.prepareForReuse()
           stepperLabel.text?.removeAll()
          }
@IBAction func StepperPressed(_ sender: UIStepper) {
  stepperLabel.text = Int(sender.value).description
    }
}

Code Block
extension PlayerAssistViewController: UITableViewDelegate, UITableViewDataSource {
      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return players.count
      }
  func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let player = players[indexPath.row]
        guard let cell = tableView.dequeueReusableCell(withIdentifier: "PlayerAssistCell") as? PlayerAssistContributionCell else {return UITableViewCell()}
        let image = UIImage(data: ((player.image  ?? defaultImage)!))
        cell.imageView?.image = image?.resize(60, 60)
        cell.playerName.text = player.name
        cell.playerRating.text = "\(player.rating)"
        cell.cellLayer(with: cell)
        cell.StepperPressed(cell.stepper)
          return cell
      }
}

The doc is a bit cryptic when it says "You should not use this method to assign any new data to the view":

When a view is dequeued for use, this method is called before the corresponding dequeue method returns the view to your code. Subclasses can override this method and use it to reset properties to their default values and generally make the view ready to use again. You should not use this method to assign any new data to the view. That is the responsibility of your data source object.

So, why do you need it ? As you reassign stepperLabel.text through line 21 ?
Is it in case dequeue failed ? In such a case why don't you create a PlayerAssistContributionCell from the appropriate cellID ?
Duplicate data on different cells when scrolling tableview
 
 
Q