Try this
typealias ActionBlock = () -> Void
class UIBlackButton: UIButton {
var actionBlock: ActionBlock = {}
func handleControlEvent(event: UIControlEvents, action: @escaping ActionBlock) {
actionBlock = action
self.addTarget(self, action: #selector(callActionBlock), for: event)
}
@objc func callActionBlock(sender: Any) {
actionBlock();
}
}
solved Convert Objective-C to Swift for these below code [closed]