Я думаю, что это проблема многократного использования в главном потоке.Вы можете использовать код ниже, где действие переключателя выполняется в главном потоке async
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if let cell = tableView.dequeueReusableCell(withIdentifier: "Cell") as? Cell {
cell.theSwitch.row = indexPath.row
DispatchQueue.main.async {
cell.theSwitch.setOn(self.array[indexPath.row], animated: false)
}
return cell
}
return UITableViewCell()
}