Created
October 15, 2017 13:31
-
-
Save serhatsezer/4ae96f55069b2e344cc097a1fb6105f3 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
| // 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