From 6cf4ba0594c70f238cbbba6ee5ea75e9012f2d48 Mon Sep 17 00:00:00 2001 From: "Robinson, Blake" Date: Thu, 19 Dec 2019 10:30:14 -0500 Subject: [PATCH] Improved swifty-ness of these lines --- MVMCoreUI/Atoms/Buttons/Button.swift | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/MVMCoreUI/Atoms/Buttons/Button.swift b/MVMCoreUI/Atoms/Buttons/Button.swift index c1e631a2..263d5cb1 100644 --- a/MVMCoreUI/Atoms/Buttons/Button.swift +++ b/MVMCoreUI/Atoms/Buttons/Button.swift @@ -34,14 +34,11 @@ public typealias ButtonBlock = (Button) -> Void } self.addBlock({ [weak self] (sender) in - guard let self = self else { return } - var performAction = true - if let shouldPerformAction = self.buttonDelegate?.button?(self, shouldPerformActionWithMap: actionMap, additionalData: additionalData) { - performAction = shouldPerformAction - } - if performAction { - MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject) - } + guard let self = self, + let performAction = self.buttonDelegate?.button?(self, shouldPerformActionWithMap: actionMap, additionalData: additionalData), + performAction else { return } + + MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject) }, event: .touchUpInside) }