diff --git a/MVMCoreUI/Atoms/Buttons/Button.swift b/MVMCoreUI/Atoms/Buttons/Button.swift index c6c187fe..cd93f755 100644 --- a/MVMCoreUI/Atoms/Buttons/Button.swift +++ b/MVMCoreUI/Atoms/Buttons/Button.swift @@ -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]?) {