Switching between queues in cellForIndexPath method
This is not a good solution to handle fetch requests inside scrolling cellForIndexPath.  

1 Fetch request should be asynchronous, because it may take time
2 Fetch request should be called in table view datasource and not in custom cell, because cell can be reused while scrolling
3 Should apply result of fetch request if cell is visible

Code in class where UITablView datasource is implemented-

func getColor(forGroup: Int, completion: @escaping (color: UIColor) -&gt; Void) {
  //fetch request
  //request processing...
  completion(resultColor)
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
  let cell = tableView.dequeueReusableCell(withIdentifier: "identifier", for: indexPath) as! CustomCell
  let myObject = //object for indexpath
  cell.configureWith(myObject: myObject)
  self.getColor(forGroup: myObject.group) { (color) in
    DispatchQueue.main.async {
      if let cell = tableView.cellForRow(at: indexPath) {
        //this unwrapping is needed as tableview returns nil if cell is not visible
        cell.colorLable(color)
    }
  }
}


In CustomCell file:

func configureWith(myObject: MyObject) {
  titleLabel.text = myObject.text
}
func colorLable(_ color: UIColor) {
  self.titleLabel.textColor = color
}