From 9b53f4bac04e3ba6e9868ad46d02ca213c629ebe Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 3 Dec 2019 09:07:43 -0500 Subject: [PATCH] Paired down constraints. Made variables public. Mild formatting. --- .../Atoms/Views/CheckboxWithLabelView.swift | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/CheckboxWithLabelView.swift b/MVMCoreUI/Atoms/Views/CheckboxWithLabelView.swift index 55f32ae9..30722295 100644 --- a/MVMCoreUI/Atoms/Views/CheckboxWithLabelView.swift +++ b/MVMCoreUI/Atoms/Views/CheckboxWithLabelView.swift @@ -19,9 +19,9 @@ // MARK: - Properties //-------------------------------------------------- - var sizeObject: MFSizeObject? = MFSizeObject(standardSize: Checkbox.defaultHeightWidth, standardiPadPortraitSize: Checkbox.defaultHeightWidth + 6.0) + public var sizeObject: MFSizeObject? = MFSizeObject(standardSize: Checkbox.defaultHeightWidth, standardiPadPortraitSize: Checkbox.defaultHeightWidth + 6.0) - var checkboxPosition: CheckboxPosition = .center + public var checkboxPosition: CheckboxPosition = .center public enum CheckboxPosition: String { case center @@ -33,10 +33,10 @@ // MARK: - Constraints //-------------------------------------------------- - var checkboxHeightConstraint: NSLayoutConstraint? - var checkboxTopConstraint: NSLayoutConstraint? - var checkboxBottomConstraint: NSLayoutConstraint? - var checkboxCenterYConstraint: NSLayoutConstraint? + public var checkboxHeightConstraint: NSLayoutConstraint? + public var checkboxTopConstraint: NSLayoutConstraint? + public var checkboxBottomConstraint: NSLayoutConstraint? + public var checkboxCenterYConstraint: NSLayoutConstraint? //-------------------------------------------------- // MARK: - Life Cycle @@ -81,12 +81,7 @@ // MARK: - Initializers //-------------------------------------------------- - required public init?(coder: NSCoder) { - super.init(coder: coder) - fatalError("xib file is not implemented for CheckboxWithLabelView") - } - - override public init(frame: CGRect) { + public override init(frame: CGRect) { super.init(frame: frame) setupView() } @@ -101,6 +96,11 @@ alignCheckbox(position) } + required public init?(coder: NSCoder) { + super.init(coder: coder) + fatalError("xib file is not implemented for CheckboxWithLabelView") + } + //-------------------------------------------------- // MARK: - Methods //-------------------------------------------------- @@ -128,11 +128,11 @@ } } -/// MARK: - Molecular +// MARK: - Molecular extension CheckboxWithLabelView { - open class func estimatedHeight(forRow json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { - return CGFloat(Checkbox.defaultHeightWidth) + open class func estimatedHeight(forRow json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { + return 200 } @objc override open func updateView(_ size: CGFloat) { @@ -142,10 +142,6 @@ extension CheckboxWithLabelView { layoutIfNeeded() } - open func alignment() -> UIStackView.Alignment { - return .leading - } - open func resetConstraints() { checkboxCenterYConstraint?.isActive = false