Skip to content

Instantly share code, notes, and snippets.

@ashour
Created April 23, 2019 11:58
Show Gist options
  • Save ashour/9a279008924b4641b6641871d143155e to your computer and use it in GitHub Desktop.
Save ashour/9a279008924b4641b6641871d143155e to your computer and use it in GitHub Desktop.
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.localizedUppercase
discountLabel.text = product.discount.localizedUppercase
expiryLabel.text =
String(format: __("expires"), product.expires).localizedUppercase
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