Created
October 1, 2018 11:11
-
-
Save DominikPetho/f4f8ae2e2191c3111118e2b33bce1600 to your computer and use it in GitHub Desktop.
Disatvantage method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
var dequeuedCell: UITableViewCell? | |
if peopleWithAdvertisementList[indexPath.row] is Advertisement { | |
dequeuedCell = tableView.dequeueReusableCell(withIdentifier: "AdvertisementCell") | |
} else if peopleWithAdvertisementList[indexPath.row] is Person { | |
dequeuedCell = tableView.dequeueReusableCell(withIdentifier: "PeopleCell") | |
} else { | |
// Else what? Do we have other type comforming to SimpleViewCellItem protocol? | |
} | |
return dequeuedCell ?? UITableViewCell() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment