title: UITableViewCell contents change when scrolling because running a timer in one of the cell
body: <p>I have an table view with 3 cells. In one of the cell I am trying to display a timer which apparently messes up my cells contents when scrolling.  </p>
  
  <p>Here is my code:</p>
  
  <pre><code>   func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
          let cell = tableView.dequeueReusableCell(withIdentifier: "cell") as! StatsuSessionTableViewCell
  
          if indexPath.row == 0 {
              // do something
              return cell
          } else if indexPath.row == 1 {
              // do something
              return cell
          } else if indexPath.row == 2 {
              _ = Timer.every(1.second) { (timer: Timer) in
                  let time = self.date.timeIntervalSince(Date())
                  cell.statusTitle.text = "TIME"
                  cell.statusDescription.text = time.timerFormat
  
                  if time &lt; 0 {
                      timer.invalidate()
                  }
              }
              return cell
          }
  
          return cell
      }
  </code></pre>
  
  <p>If I remove the timer and just display some text, I don't have any issue. But apparently because cell's are destroyed and recreated this messes up my contents, the timer would also appear at indexpath.row 0 not just indepxath.row 2.  </p>
  
  <p>Is there any workaround for this ? </p>