title: How to change the backgroungColor cell in tableView with timeInterval using Swift
body: <p>I'm trying to change the cell backgroungColor after 3.5 month. I have a textField where i put the date and after 3.5 month of that date I want to change the color of the cell in red.</p>
  <p>I tried this where date1 is the date from textField and date2 is this from (isToday) where i have put 106 day = 3.5 month</p>
  <pre><code> let isToday= Date.now.addingTimeInterval(106)
  
  func isSameDay(date1: Date, date2: Date) -&gt; Bool {
      let diff = Calendar.current.dateComponents([.day], from: date1, to: date2)
      if diff.day == 0 {
          return true
      }
      else {
          return false
      }
  }
  </code></pre>
  <p>Inside <strong>cellForRowAt</strong> i have used like this</p>
  <pre><code>     var documentSendDate = &quot;05.08.2022&quot;// this is example to be more understandable
  
      let dateFormatter = DateFormatter()
      dateFormatter.dateFormat = &quot;MMM/dd/yyyy&quot;
      let date = dateFormatter.date(from: documentSendDate)
  
      if date != nil {
          let isDayToday = isSameDay(date1: date!, date2: isToday) // here I call the function above
  
          if isDayToday  == true {
  
              if customer.isToday == true {
                  cell.backgroundColor = .red
              }
          }
      }
  </code></pre>
  <p>But I have this checkBox and when I check it or uncheck it change the color of the random cells. <strong>Can someone help me with this please?</strong>
  <a href="https://i.stack.imgur.com/0wWVh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0wWVh.png" alt="enter image description here" /></a></p>
  <p><strong>Here is how i wanted to look.</strong></p>
  <p><a href="https://i.stack.imgur.com/zEJEY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zEJEY.png" alt="enter image description here" /></a></p>