// Первый подкласс
class reportCell: UITableViewCell {
@IBOutlet weak var view1: UIView!
@IBOutlet weak var repLabel: UILabel!
}
// Второй подкласс
class sectionCell: UITableViewCell {
@IBOutlet weak var view2: UIView!
@IBOutlet weak var secLabel: UILabel!
}
//
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if cellType == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "cellRep", for: indexPath) as! reportCell
cell.repLabel?.text = type[indexPath.row]
cell.view1.backgroundColor = UIColor(red: 25/255, green: 34/255, blue: 40/255, alpha: 1)
return cell
}
if cellType == 1 {
let cell = tableView.dequeueReusableCell(withIdentifier: "cellSec", for: indexPath) as! sectionCell
cell.secLabel?.text = type[indexPath.row]
cell.view2.backgroundColor = UIColor(red: 201/255, green: 113/255, blue: 91/255, alpha: 1)
return cell
}
return UITableViewCell()
}