From d8d691f2cc5267f0b0725b2b7b5eea84896896e1 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 20 Apr 2020 17:46:50 -0400 Subject: [PATCH] resolvong a constraint issue --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 8 +------- .../LeftRightViews/ToggleMolecules/LabelToggle.swift | 5 ++++- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index c14e20fc..eab07e0f 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -135,12 +135,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) knobLeadingConstraint?.isActive = false knobTrailingConstraint?.isActive = false - if isOn { - constrainKnobOn() - - } else { - constrainKnobOff() - } + _ = isOn ? constrainKnobOn() : constrainKnobOff() knobTrailingConstraint?.isActive = true knobLeadingConstraint?.isActive = true @@ -242,7 +237,6 @@ public typealias ActionBlockConfirmation = () -> (Bool) bottomAnchor.constraint(greaterThanOrEqualTo: knobView.bottomAnchor).isActive = true constrainKnobOff() - knobLeadingConstraint?.isActive = true } public override func reset() { diff --git a/MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/LabelToggle.swift b/MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/LabelToggle.swift index 17a645ed..3ff3a41f 100644 --- a/MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/LabelToggle.swift +++ b/MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/LabelToggle.swift @@ -8,6 +8,7 @@ import UIKit + @objcMembers open class LabelToggle: View { //-------------------------------------------------- // MARK: - Properties @@ -38,7 +39,9 @@ import UIKit open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { guard let model = model as? LabelToggleModel, let toggleHeight = Toggle.estimatedHeight(with: model.toggle, delegateObject), - let labelHeight = Label.estimatedHeight(with: model.label, delegateObject) else { return nil } + let labelHeight = Label.estimatedHeight(with: model.label, delegateObject) + else { return nil } + return max(toggleHeight, labelHeight) }