AutoCat/AutoCat/Extensions/Buttons.swift
Selim Mustafaev 7e0608b52e New filters
2020-09-26 22:34:14 +03:00

19 lines
497 B
Swift

import UIKit
class ActionButton: UIButton {
var actionHandler: (() -> Void)? {
didSet {
self.removeTarget(self, action: #selector(self.actionImpl), for: .touchUpInside)
self.addTarget(self, action: #selector(self.actionImpl), for: .touchUpInside)
}
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
@objc private func actionImpl() -> Void {
self.actionHandler?()
}
}