Skip to content

Instantly share code, notes, and snippets.

@amlcurran
Created November 29, 2016 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amlcurran/fff16baa33f5a339cdc1dd1cd3d078b9 to your computer and use it in GitHub Desktop.
Save amlcurran/fff16baa33f5a339cdc1dd1cd3d078b9 to your computer and use it in GitHub Desktop.
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if let promotion = recipes[indexPath.row].promotion {
let promotedCell = tableView.dequeueReusableCell(withIdentifier: "promoted", for: indexPath) as! PromotedRecipeCell
promotedCell.recipe = recipe
promotedCell.promotion = promotion
return promotedCell
} else {
let normalCell = tableView.dequeueReusableCell(withIdentifier: "normal", for: indexPath) as! RecipeCell
normalCell.recipe = recipe
return normalCell
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment