Skip to content

Instantly share code, notes, and snippets.

@ashour
Last active April 9, 2019 08:52
Show Gist options
  • Save ashour/dbc745d950aa08f97421705b687c95c2 to your computer and use it in GitHub Desktop.
Save ashour/dbc745d950aa08f97421705b687c95c2 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.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