diff --git a/MVMCoreUI/Molecules/HorizontalCombinationViews/TwoButtonView.swift b/MVMCoreUI/Molecules/HorizontalCombinationViews/TwoButtonView.swift index bc45f67d..2c5f0fe5 100644 --- a/MVMCoreUI/Molecules/HorizontalCombinationViews/TwoButtonView.swift +++ b/MVMCoreUI/Molecules/HorizontalCombinationViews/TwoButtonView.swift @@ -98,7 +98,7 @@ import UIKit } func setupWithTwoButtons() { - guard self.viewForButtons == nil else { + guard viewForButtons == nil else { return } let viewForButtons = MVMCoreUICommonViewsUtility.commonView() @@ -114,8 +114,7 @@ import UIKit } open func setupWithPrimaryButton() { - // should not allow primaryButton addition, if secondaryButton exists - guard (self.primaryButton == nil && self.secondaryButton == nil) else { + guard primaryButton == nil && secondaryButton == nil else { return } createPrimaryButton() @@ -127,8 +126,7 @@ import UIKit } open func setupWithSecondaryButton() { - // should not allow secondaryButton addition, if primaryButton exists - guard (self.secondaryButton == nil && self.primaryButton == nil) else { + guard secondaryButton == nil && primaryButton == nil else { return } createSecondaryButton() @@ -154,8 +152,10 @@ import UIKit } } else if secondaryButtonMap != nil { heightConstraint?.isActive = false - removeButtons() - setupWithSecondaryButton() + if secondaryButton == nil || primaryButton != nil { + removeButtons() + setupWithSecondaryButton() + } } else { removeButtons() if heightConstraint == nil {