Skip to content

Instantly share code, notes, and snippets.

@serhatsezer
Created October 15, 2017 13:31
Show Gist options
  • Save serhatsezer/4ae96f55069b2e344cc097a1fb6105f3 to your computer and use it in GitHub Desktop.
Save serhatsezer/4ae96f55069b2e344cc097a1fb6105f3 to your computer and use it in GitHub Desktop.
// Here we are creating representables for to take advantage of all representables.
typealias Representables = TextPresentable & SwitchPresentable & ImagePresentable
class ProductListCell: UITableViewCell {
@IBOutlet private weak var label: UILabel!
@IBOutlet private weak var switch: UISwitch!
@IBOutlet private weak var imageView: UIImageView!
func configure(presenter: Representables) {
label.text = presenter.text
switch.on = presenter.switchOn
imageView.image = UIImage(named: presenter.imageName)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment