I have a simple button in a cocoapods library, I need to change the tintcolor when it is isHighlighted
however isHighlighted gets called but didset or willset never get called.
I am ofcourse setting my button to be highlighted, and I call this function after I dequeue my tableview cell
func setupCell() {
let myCustomButton = UIButton.button(title: "Button")
myCustomButton.isHighlighted = true
}
My UIButton Extension
extension UIButton {
public static func button(title: String) -> UIButton {
let button = UIButton(type: .custom)
button.setTitle(title, for: .normal)
button.setTitleColor(UIColor.gray, for: .normal)
return button
}
override open var isHighlighted: Bool {
didSet {
print("Never gets here, ever!")
}
}
}
How can I trigger didSet? Is there any other way apart from setting isHighlighted to true?