I am using a UIButton of custom type and what I want is use it like a toggle switch with the change of image. Like when it is clicked if previously it was not in selected mo
My implementation of a UIButton as a Switch.
class ButtonSwitch: UIButton { override func sendAction(_ action: Selector, to target: Any?, for event: UIEvent?) { if allControlEvents == .touchUpInside { isSelected.toggle() } super.sendAction(action, to: target, for: event) } }