title: Can't reset UILabel attributedText when a UITableViewCell is reused
body: <h2>The problem</h2>
  
  <p>I'm using a <code>UITableView</code> to show the list of transactions of a credit card. If the transaction is a chargeback, I'm adding a strikethrough style to the label:</p>
  
  <p><a href="https://i.stack.imgur.com/ZlSU3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ZlSU3.png" alt="Example of my UITableViewCells"></a></p>
  
  <p>The problem happens when that specific cell is reused. The strikethrought decoration is still there, even after resetting the <code>text</code> and <code>attributedText</code> property of the label.</p>
  
  <p>Below I've added the relevant parts of my code:</p>
  
  <h2>Table view</h2>
  
  <pre><code>class TimelineViewController: UIViewController {
  
      private lazy var tableView: UITableView = {
          let tableView = UITableView.init(frame: view.frame, style: .plain)
          tableView.translatesAutoresizingMaskIntoConstraints = false
          tableView.register(TimelineTableViewCell.self, forCellReuseIdentifier: TimelineTableViewCell.reuseIdentifier)
          tableView.dataSource = self
          tableView.delegate = self
          return tableView
      }()
  
      override func viewDidLoad() {
          super.viewDidLoad()
          addTableViewOnView()
          getTimeline()
      }
  
  }
  
  extension TimelineViewController: UITableViewDataSource {
  
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
          guard let cell = tableView.dequeueReusableCell(withIdentifier: TimelineTableViewCell.reuseIdentifier,
                                                         for: indexPath) as? TimelineTableViewCell else { fatalError() }
          cell.transactionData = viewModel.timeline[indexPath.row]
          return cell
      }
  
  }
  </code></pre>
  
  <h2>Table view cell</h2>
  
  <pre><code>class TimelineTableViewCell: UITableViewCell {
  
      static let reuseIdentifier = "TimelineTableViewCell"
  
      var transactionData: TimelineResponseModel! {
          didSet {
              // Reset the labels
              transactionDescriptionLabel.text = nil
              transactionDescriptionLabel.attributedText = nil
              transactionValueLabel.text = nil
              transactionValueLabel.attributedText = nil
  
              // Fill in the values
              transactionDescriptionLabel.text = transactionData.description
              transactionValueLabel.text = Formatter.currency.string(for: transactionData.balance)
  
              if transactionData.isChargeback {
                  let value = Formatter.currency.string(for: transactionData.balance) ?? ""
                  transactionDescriptionLabel.attributedText = transactionData.description.strikedThrough()
                  transactionValueLabel.attributedText = value.strikedThrough()
              }
          }
      }
  
      private lazy var transactionDescriptionLabel: UILabel = {
          let transactionDescriptionLabel = UILabel()
          transactionDescriptionLabel.translatesAutoresizingMaskIntoConstraints = false
          transactionDescriptionLabel.font = UIFont.preferredFont(forTextStyle: .footnote)
          transactionDescriptionLabel.adjustsFontForContentSizeCategory = true
          transactionDescriptionLabel.textColor = UIColor.activeText()
          transactionDescriptionLabel.numberOfLines = 0
          return transactionDescriptionLabel
      }()
  
      private lazy var transactionValueLabel: UILabel = {
          let transactionValueLabel = UILabel()
          transactionValueLabel.translatesAutoresizingMaskIntoConstraints = false
          transactionValueLabel.font = UIFont.preferredFont(forTextStyle: .caption1).bold()
          transactionValueLabel.adjustsFontForContentSizeCategory = true
          transactionValueLabel.textColor = UIColor.activeText()
          return transactionValueLabel
      }()
  
      override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
          super.init(style: style, reuseIdentifier: reuseIdentifier)
          addTransactionDescriptionLabel()
          addTransactionValueLabel()
      }
  
  }
  </code></pre>
  
  <h2>Strikethrough style</h2>
  
  <pre><code>extension String {
  
      func strikedThrough() -&gt; NSAttributedString {
          let strikethroughStyle = [NSAttributedString.Key.strikethroughStyle: NSUnderlineStyle.single.rawValue]
          return NSAttributedString(string: self, attributes: strikethroughStyle)
      }
  
  }
  </code></pre>
  
  <h2>What I've tried</h2>
  
  <p>I've tried some approaches, without success:</p>
  
  <ul>
  <li>Override <code>prepareForReuse</code> and reset the <code>text</code> and <code>attributedText</code> of the label there.</li>
  <li>Create an <code>else</code> after the <code>if transactionData.isChargeback</code> to set the <code>transactionDescriptionLabel</code> and <code>transactionValueLabel</code> attributed text without the decoration</li>
  </ul>
  
  <p>So, when the cell is reused, how can I reset it's labels to remove the strikethrough style I've added before?</p>