Created
April 2, 2019 05:43
-
-
Save Abhishek9634/9bc0742000c1ffc1ef0a2f33f0ec24bb to your computer and use it in GitHub Desktop.
This file contains 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 | |
class DropDownTableViewCell: UITableViewCell { | |
@IBOutlet weak var titleLabel: UILabel! | |
@IBOutlet weak var imgView: UIImageView! | |
var item: Any? { | |
didSet { | |
self.configure(self.item) | |
} | |
} | |
override func awakeFromNib() { | |
super.awakeFromNib() | |
} | |
func configure(_ item: Any?) { | |
guard let model = item as? DropDownCellModel else { return } | |
self.titleLabel.text = model.item.value | |
self.updateUI(model.isSelected) | |
} | |
private func updateUI(_ flag: Bool) { | |
self.titleLabel.textColor = flag ? .blue : .black | |
self.imgView.isHidden = !flag | |
self.titleLabel.textColor = flag ? UIColor(hexString: "1098BC") : .black | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment