title: How can i dynamically change colors of the table prototype cell labels in the interval
body: <p>i have been searching a logic to dynamically change colors of labels in the tableView , i am using an arrayList to print subjects (hindi,english,maths,punjabi, geography) printed on the tabels prototype cell , now i want to change colors of all the subjects in the interval of every three , like first cell label should be red, second should be green , and third should be white , and follow this dynamic rule for furthur cells </p>
  
  <p>here is the method i used to print static cell label colors</p>
  
  <pre><code>    switch subjectsList[indexPath.row] {
      case subjectsList[1],subjectsList[4]:
          cell.subjectFirstLetter.textColor = UIColor.orange
      case subjectsList[2],subjectsList[5]:
          cell.subjectFirstLetter.textColor = UIColor.red
      default:
          cell.subjectFirstLetter.textColor = UIColor.white
      }
  </code></pre>
  
  <p>how can i make this dynamic ?</p>
  
  <p>Update :- solved</p>
  
  <pre><code>let remainder = indexPath.row % 3
  switch remainder {
  case 1:
      cell.subjectFirstLetter.textColor = .orange
  case 2:
      cell.subjectFirstLetter.textColor = .red
  default: // e.g. zero
      cell.subjectFirstLetter.textColor = .white
  }
  </code></pre>