Rewrote ButtonTapBlock in swift
This commit is contained in:
parent
4b855a1a63
commit
109ef54479
@ -6,22 +6,22 @@
|
||||
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
public typealias ButtonBlock = (Button) -> Void
|
||||
|
||||
@objcMembers open class Button: UIButton, MFButtonProtocol {
|
||||
|
||||
public var actionMap: [AnyHashable: Any]?
|
||||
public weak var buttonDelegate: ButtonDelegateProtocol?
|
||||
private var buttonBlock: ButtonBlock?
|
||||
|
||||
//Does buttonTap block need to be rewritten in swift?
|
||||
private var buttonTapBlock: ButtonTapBlock?
|
||||
|
||||
public func addBlock(_ buttonTapBlock: @escaping ButtonTapBlock, event: Event) {
|
||||
self.buttonTapBlock = buttonTapBlock
|
||||
public func addBlock(_ buttonBlock: @escaping ButtonBlock, event: Event) {
|
||||
self.buttonBlock = buttonBlock
|
||||
addTarget(self, action: #selector(callBlock(_:)), for: event)
|
||||
}
|
||||
|
||||
func callBlock(_ sender: Button) {
|
||||
guard let buttonTapBlock = buttonTapBlock else { return }
|
||||
buttonTapBlock(self)
|
||||
guard let buttonBlock = buttonBlock else { return }
|
||||
buttonBlock(self)
|
||||
}
|
||||
|
||||
public func setWithActionMap(_ actionMap: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user