Created
August 16, 2018 21:28
-
-
Save Abhishek9634/dc1f136a36b0900896cb01ceeaf004b0 to your computer and use it in GitHub Desktop.
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
// | |
// BeerTableViewCell.swift | |
// BeerCrafts | |
// | |
// Created by Abhishek on 29/06/18. | |
// Copyright © 2018 Abhishek. All rights reserved. | |
// | |
import UIKit | |
protocol BeerTableViewCellDelegate: class { | |
func didTapAddButton(cell: BeerTableViewCell) | |
} | |
class BeerTableViewCell: TableViewCell { | |
@IBOutlet weak var themeLabel: UILabel! | |
@IBOutlet weak var nameLabel: UILabel! | |
@IBOutlet weak var alcoholContentLabel: UILabel! | |
override func awakeFromNib() { | |
super.awakeFromNib() | |
} | |
override func setSelected(_ selected: Bool, animated: Bool) { | |
super.setSelected(selected, animated: animated) | |
} | |
override func configure(_ item: Any?) { | |
guard let model = item as? BeerCellModel else { return } | |
self.themeLabel.text = model.beer.style | |
self.nameLabel.text = model.beer.name | |
self.alcoholContentLabel.text = model.beer.abv | |
} | |
@IBAction func addAction(_ sender: Any) { | |
(self.delegate as? BeerTableViewCellDelegate)?.didTapAddButton(cell: self) | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment