title: TableView issue with reuse system and design programmatically
body: <p>I have a problem with my cells where I remove/insert to my <code>tableView</code>, I delete and insert my cells like that : </p>
  
  <pre><code>self.tableView.beginUpdates()
  user.lobbySurvey.remove(at: 0)
  self.tableView.deleteRows(at: [IndexPath(row: 0, section: 0)], with: .fade)
  self.tableView.endUpdates()
  </code></pre>
  
  <p>Insert: </p>
  
  <pre><code>self.tableView.beginUpdates()
  user.lobbySurvey.insert(surveyEnded, at: rowToInsert)
  self.tableView.insertRows(at: [IndexPath(row: rowToInsert, section: 0)], with: .fade)
  self.tableView.endUpdates()
  </code></pre>
  
  <p><code>lobbySurvey</code> is the data array of the TableView.
  Problem is the cell I add keep the design of the first cell that I delete previously.</p>
  
  <p>I think this issue is because I check if the card is draw or not. If not checked: the view of the card is added each time the cell is reuse.
  this is how I check if the cell is draw or not :</p>
  
  <pre><code>func drawSurveyEnded(){
      if(cardIsDraw == false){
          surveyEnded.draw(cardView: self.cardView)
          surveyEnded.delegate = self
          self.addCardShadow()
          cardIsDraw = true
      }
  }
  </code></pre>
  
  <p>The function is called many times cause to the reuse system of iOS. So I think my problem come from here.</p>
  
  <p>Why my cell in my tableView keep the design of the previous cell that I deleted?</p>
  
  <p><strong>Other code :</strong> </p>
  
  <pre><code>func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
  let cell = tableView.dequeueReusableCell(withIdentifier:"Celll") as! CardCell
  for survey in user.lobbySurvey{
      let index = user.lobbySurvey.index(where: {
          //get the current index is nedeed else the cells reuse lazy
          $0 === survey
      })
      if indexPath.row == index{
          var surveyState : UserSurvey.state
          surveyState = survey.state
          switch surveyState{
          case .selectSurvey:
              cell.drawCard(statutOfCard: .selectSurvey)
          case .goSurvey:
              cell.drawCard(statutOfCard: .goSurvey(picture: survey.picture))
          case .surveyEnded:
              cell.drawCard(statutOfCard: .surveyEnded(picture: survey.picture))
          case .surveyWork:
              print("survey in progress to vote")
          case .surveyWaiting:
              cell.drawCard(statutOfCard: .surveyWaiting(selfSurveyId: survey.id, timeLeft: survey.timeLeft, picture: survey.picture))
          case .buyStack:
              cell.drawCard(statutOfCard: .buyStack(supView : self.view))
          }
      }
  }
  
  cell.delegate = self
  cell.delegateCard = self
  cell.layer.backgroundColor = UIColor.clear.cgColor
  cell.backgroundColor = .clear
  tableView.backgroundColor = .clear
  tableView.layer.backgroundColor = UIColor.clear.cgColor
  return cell
  }
  </code></pre>
  
  <p>Draw card is a simple switch of the state of the survey where called the good function to create the card like this one I posted before : <code>drawSurveyEnded</code></p>