diff --git a/MVMCoreUI/Atoms/Views/LabelWithInternalButton.swift b/MVMCoreUI/Atoms/Views/LabelWithInternalButton.swift index 2befda5a..5cc6d50b 100644 --- a/MVMCoreUI/Atoms/Views/LabelWithInternalButton.swift +++ b/MVMCoreUI/Atoms/Views/LabelWithInternalButton.swift @@ -14,7 +14,7 @@ public typealias ButtonObjectDelegate = NSObjectProtocol & ButtonDelegateProtoco public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProtocol & MVMCoreLoadDelegateProtocol & MVMCorePresentationDelegateProtocol & NSObjectProtocol -@available(*, deprecated, message: "This class is deprecated, please use the Label class.") +@available(*, deprecated, message: "Use Label instead.") @objcMembers open class LabelWithInternalButton: UIControl, MVMCoreViewProtocol, MFButtonProtocol, MVMCoreUIMoleculeViewProtocol { //------------------------------------------------------ // MARK: - Properties diff --git a/MVMCoreUI/Atoms/Views/LeftRightLabelView.swift b/MVMCoreUI/Atoms/Views/LeftRightLabelView.swift index c415ab03..d5cf579b 100644 --- a/MVMCoreUI/Atoms/Views/LeftRightLabelView.swift +++ b/MVMCoreUI/Atoms/Views/LeftRightLabelView.swift @@ -26,14 +26,6 @@ import Foundation var rightTextLabelLeading: NSLayoutConstraint? - //------------------------------------------------------ - // MARK: - Properties - //------------------------------------------------------ - - var leftRightMarginsValue: CGFloat { - return layoutMargins.left + layoutMargins.right - } - //------------------------------------------------------ // MARK: - Initialization //------------------------------------------------------ @@ -80,7 +72,7 @@ import Foundation rightTextLabel.updateView(size) if leftTextLabel.hasText && rightTextLabel.hasText { - rightTextLabel.preferredMaxLayoutWidth = (size - leftRightMarginsValue) * 0.4 + rightTextLabel.preferredMaxLayoutWidth = floor((size - 16) * 0.4) } } @@ -113,16 +105,16 @@ import Foundation bottomAnchor.constraint(greaterThanOrEqualTo: rightTextLabel.bottomAnchor).isActive = true - leftTextWidth = leftTextLabel.widthAnchor.constraint(greaterThanOrEqualTo: widthAnchor, multiplier: 0.6, constant: -leftRightMarginsValue) + leftTextWidth = leftTextLabel.widthAnchor.constraint(greaterThanOrEqualTo: layoutMarginsGuide.widthAnchor, multiplier: 0.6) leftTextWidth?.priority = UILayoutPriority(rawValue: 995) leftTextWidth?.isActive = true - rightTextWidth = rightTextLabel.widthAnchor.constraint(lessThanOrEqualTo: widthAnchor, multiplier: 0.4, constant: -leftRightMarginsValue) + rightTextWidth = rightTextLabel.widthAnchor.constraint(lessThanOrEqualTo: layoutMarginsGuide.widthAnchor, multiplier: 0.4) rightTextWidth?.priority = UILayoutPriority(rawValue: 906) rightTextWidth?.isActive = true - leftTextLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal) - rightTextLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 901), for: .horizontal) + leftTextLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 901), for: .horizontal) + rightTextLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 902), for: .horizontal) leftTextLabel.setContentHuggingPriority(.required, for: .vertical) rightTextLabel.setContentHuggingPriority(.required, for: .vertical) @@ -137,7 +129,7 @@ import Foundation rightTextLabelLeading?.isActive = false layoutMarginsGuide.trailingAnchor.constraint(equalTo: leftTextLabel.trailingAnchor).isActive = true leftTextWidth?.isActive = false - leftTextWidth = leftTextLabel.widthAnchor.constraint(equalTo: widthAnchor, multiplier: 1.0, constant: -leftRightMarginsValue) + leftTextWidth = leftTextLabel.widthAnchor.constraint(equalTo: layoutMarginsGuide.widthAnchor, multiplier: 1.0) leftTextWidth?.priority = UILayoutPriority(rawValue: 999) leftTextWidth?.isActive = true } @@ -146,9 +138,9 @@ import Foundation rightTextLabelLeading?.isActive = false rightTextLabel.trailingAnchor.constraint(equalTo: layoutMarginsGuide.trailingAnchor).isActive = true - layoutMarginsGuide.leadingAnchor.constraint(equalTo: rightTextLabel.leadingAnchor).isActive = true + rightTextLabel.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor).isActive = true rightTextWidth?.isActive = false - rightTextWidth = rightTextLabel.widthAnchor.constraint(equalTo: widthAnchor, multiplier: 1.0, constant: -leftRightMarginsValue) + rightTextWidth = rightTextLabel.widthAnchor.constraint(equalTo: layoutMarginsGuide.widthAnchor, multiplier: 1.0) rightTextWidth?.priority = UILayoutPriority(rawValue: 999) rightTextWidth?.isActive = true } @@ -183,8 +175,4 @@ import Foundation constrainLeftLabel() } } - - open override func needsToBeConstrained() -> Bool { - return true - } }