Last active
April 9, 2019 08:52
-
-
Save ashour/dbc745d950aa08f97421705b687c95c2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import UIKit | |
import SDWebImage | |
class FeedTableViewCell: UITableViewCell | |
{ | |
@IBOutlet weak var productNameLabel: UILabel! | |
@IBOutlet weak var storeNameLabel: UILabel! | |
@IBOutlet weak var discountLabel: UILabel! | |
@IBOutlet weak var expiryLabel: UILabel! | |
@IBOutlet weak var priceAfterDiscountLabel: UILabel! | |
@IBOutlet weak var priceBeforeDiscountLabel: UILabel! | |
@IBOutlet weak var productImageView: UIImageView! | |
func updateUI(with product: Product) | |
{ | |
productNameLabel.text = product.name | |
storeNameLabel.text = product.store.uppercased() | |
discountLabel.text = product.discount.uppercased() | |
expiryLabel.text = "Expires \(product.expires)".uppercased() | |
priceAfterDiscountLabel.text = product.priceAfterDiscount | |
priceBeforeDiscountLabel.attributedText = | |
strikeThrough(product.priceBeforeDiscount) | |
productImageView.sd_setImage(with: URL(string: product.imageUrl)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment