I created two different cells to show different data in them. And I assigned reuseIdentifier
("TableCell"
and "FixtureCell"
) to them. They have two different classes named FixtureTableViewCell
and LeagueTableViewCell
I want to do that if the cell identifier is "TableCell"
show TableCell
.
Else if the cell identifier is "FixtureCell"
, show FixtureCell
.
How can I do this control?
My code is as below. I did only "TableCell"
. I couldn't do for the other one.
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tblLeagueTable.dequeueReusableCell(withIdentifier: "TableCell", for: indexPath) as! LeagueTableViewCell
let teams = tableArray[indexPath.row]
cell.lblLeagueTableTeam.text! = teams.teamName
cell.lblOwnGoal.text! = teams.ownGoal
cell.lblScoredGoal.text! = teams.scoredGoal
cell.lblLeagueTableTotalMatch.text! = teams.totalMatch
cell.lblTotalPoints.text! = teams.totalPoint
return cell
}