From ba84d2780dfac5e09d57f353d492b1de9f10ab36 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 24 Jun 2019 10:48:28 -0400 Subject: [PATCH 01/22] Added standardlistitem. --- MVMCoreUI.xcodeproj/project.pbxproj | 4 + .../Views/StandardListItemWithImage.swift | 146 ++++++++++++++++++ 2 files changed, 150 insertions(+) create mode 100644 MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index d45f3185..24108276 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -18,6 +18,7 @@ 01DF55E021F8FAA800CC099B /* MFTextFieldListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01DF55DF21F8FAA800CC099B /* MFTextFieldListView.swift */; }; 01DF567021FA5AB300CC099B /* TextFieldListFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01DF566F21FA5AB300CC099B /* TextFieldListFormViewController.swift */; }; 01E569D3223FFFA500327251 /* ThreeLayerViewController.swift in Headers */ = {isa = PBXBuildFile; fileRef = D2A5146A2214905000345BFB /* ThreeLayerViewController.swift */; settings = {ATTRIBUTES = (Public, ); }; }; + 0A1214A022C11A18007C7030 /* StandardListItemWithImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A12149F22C11A17007C7030 /* StandardListItemWithImage.swift */; }; B8200E152280C4CF007245F4 /* ProgressBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8200E142280C4CF007245F4 /* ProgressBar.swift */; }; B8200E192281DC1A007245F4 /* ProgressBarWithLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8200E182281DC1A007245F4 /* ProgressBarWithLabel.swift */; }; D206997721FB8A0B00CAE0DE /* MVMCoreUINavigationController.h in Headers */ = {isa = PBXBuildFile; fileRef = D206997521FB8A0B00CAE0DE /* MVMCoreUINavigationController.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -186,6 +187,7 @@ 01CA51B4229716F60071A6EE /* Switch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Switch.swift; sourceTree = ""; }; 01DF55DF21F8FAA800CC099B /* MFTextFieldListView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MFTextFieldListView.swift; sourceTree = ""; }; 01DF566F21FA5AB300CC099B /* TextFieldListFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldListFormViewController.swift; sourceTree = ""; }; + 0A12149F22C11A17007C7030 /* StandardListItemWithImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StandardListItemWithImage.swift; sourceTree = ""; }; B8200E142280C4CF007245F4 /* ProgressBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressBar.swift; sourceTree = ""; }; B8200E182281DC1A007245F4 /* ProgressBarWithLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressBarWithLabel.swift; sourceTree = ""; }; D206997521FB8A0B00CAE0DE /* MVMCoreUINavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUINavigationController.h; sourceTree = ""; }; @@ -620,6 +622,7 @@ D22D1F45220496A30077CEC0 /* MVMCoreUISwitch.m */, DBC4391C2245232D001AB423 /* LabelWithInternalButton.swift */, DB891E822253FA8500022516 /* Label.swift */, + 0A12149F22C11A17007C7030 /* StandardListItemWithImage.swift */, 0198F7A02256A80A0066C936 /* MFRadioButton.h */, 0198F7A22256A80A0066C936 /* MFRadioButton.m */, ); @@ -975,6 +978,7 @@ D29DF13221E6851E003B2FB9 /* MVMCoreUITopAlertBaseView.m in Sources */, D29DF29C21E7ADB9003B2FB9 /* MFProgrammaticTableViewController.m in Sources */, 0105618E224BBE7700E1557D /* FormValidator+TextFields.swift in Sources */, + 0A1214A022C11A18007C7030 /* StandardListItemWithImage.swift in Sources */, D29DF2BE21E7BEA4003B2FB9 /* TopTabbar.m in Sources */, D2A514632213643100345BFB /* MoleculeStackCenteredTemplate.swift in Sources */, D29DF32421ED0DA2003B2FB9 /* TextButtonView.m in Sources */, diff --git a/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift b/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift new file mode 100644 index 00000000..69062ea1 --- /dev/null +++ b/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift @@ -0,0 +1,146 @@ +// +// StandardListItemWithImage.swift +// MVMCoreUI +// +// Created by Christiano, Kevin on 6/20/19. +// Copyright © 2019 Verizon Wireless. All rights reserved. +// + +import UIKit + + +@objcMembers open class StandardListItemWithImage: ViewConstrainingView { + //------------------------------------------------------ + // MARK: - Outlets + //------------------------------------------------------ + + let title = Label.commonLabelH3(true) + let message = Label.commonLabelB3(true) + let button = ButtonView(frame: .zero) + let imageloader = MFLoadImageView() + let leftContainer = ViewConstrainingView.empty() + + //------------------------------------------------------ + // MARK: - Constraints + //------------------------------------------------------ + + //------------------------------------------------------ + // MARK: - Initialization + //------------------------------------------------------ + + public init() { + super.init(frame: .zero) + } + + public override init(frame: CGRect) { + super.init(frame: frame) + } + + required public init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + } + + public convenience init(json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) { + self.init() + setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) + } + + //------------------------------------------------------ + // MARK: - View Lifecycle + //------------------------------------------------------ + + override open func setupView() { + super.setupView() + + guard subviews.isEmpty else { return } + + addSubview(leftContainer) + leftContainer.addSubview(title) + leftContainer.addSubview(message) + leftContainer.addSubview(button) + addSubview(imageloader) + + imageloader.translatesAutoresizingMaskIntoConstraints = false + button.translatesAutoresizingMaskIntoConstraints = false + + imageloader.imageView.contentMode = .scaleAspectFit + + leftContainer.topAnchor.constraint(equalTo: topAnchor).isActive = true + leftContainer.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor).isActive = true + + let leftContainerBottom = leftContainer.bottomAnchor.constraint(equalTo: bottomAnchor) + leftContainerBottom.priority = UILayoutPriority(249) + leftContainerBottom.isActive = true + + bottomAnchor.constraint(greaterThanOrEqualTo: leftContainer.bottomAnchor).isActive = true + + title.topAnchor.constraint(equalTo: topAnchor).isActive = true + title.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true + + title.widthAnchor.constraint(equalTo: leftContainer.widthAnchor).isActive = true + + message.topAnchor.constraint(equalTo: title.bottomAnchor, constant: 6).isActive = true + message.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true + + message.widthAnchor.constraint(equalTo: leftContainer.widthAnchor).isActive = true + + imageloader.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true + layoutMarginsGuide.trailingAnchor.constraint(equalTo: imageloader.trailingAnchor).isActive = true + imageloader.topAnchor.constraint(greaterThanOrEqualTo: topAnchor).isActive = true + + let imageloaderBottom = imageloader.bottomAnchor.constraint(equalTo: bottomAnchor) + imageloaderBottom.priority = UILayoutPriority(249) + imageloaderBottom.isActive = true + + bottomAnchor.constraint(greaterThanOrEqualTo: imageloader.bottomAnchor).isActive = true + + imageloader.leadingAnchor.constraint(equalTo: leftContainer.trailingAnchor, constant: 16).isActive = true + + button.topAnchor.constraint(equalTo: message.bottomAnchor, constant: 12).isActive = true + button.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true + + title.setContentHuggingPriority(UILayoutPriority(rawValue: 901), for: .horizontal) + message.setContentHuggingPriority(UILayoutPriority(rawValue: 902), for: .horizontal) + + title.setContentHuggingPriority(.required, for: .vertical) + message.setContentHuggingPriority(.required, for: .vertical) + + title.setContentCompressionResistancePriority(.required, for: .vertical) + message.setContentCompressionResistancePriority(.required, for: .vertical) + } + + override open func updateView(_ size: CGFloat) { + super.updateView(size) + } + + override open func reset() { + super.reset() + + title.text = "" + message.text = "" + imageloader.imageView.image = nil + backgroundColor = nil + } + + open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) { + super.setWithJSON(json, delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData) + + guard let dictionary = json else { return } + + title.setWithJSON(dictionary.optionalDictionaryForKey("title"), delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData) + message.setWithJSON(dictionary.optionalDictionaryForKey("message"), delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData) + button.setWithJSON(dictionary.optionalDictionaryForKey("button"), delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData) + imageloader.setWithJSON(dictionary.optionalDictionaryForKey("imageView"), delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData) + + if let imageJSON = dictionary.optionalDictionaryForKey("imageView") { + imageloader.loadImage(withName: imageJSON.optionalStringForKey("image"), + format: imageJSON.optionalStringForKey("imageFormat"), + width: imageJSON.int32ForKey("imageWidth") as NSNumber, + height: imageJSON.int32ForKey("imageHeight") as NSNumber) + } + + if let backgroundColorHex = dictionary[KeyBackgroundColor] as? String { + backgroundColor = UIColor.mfGet(forHex: backgroundColorHex) + } + } +} From 569ae1481c5c78d002bde22831e4daf5786989d6 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 24 Jun 2019 16:04:06 -0400 Subject: [PATCH 02/22] latest iteration. --- .../Views/StandardListItemWithImage.swift | 28 ++++++++++--------- .../MVMCoreUIMoleculeMappingObject.m | 3 +- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift b/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift index 69062ea1..83ab4498 100644 --- a/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift +++ b/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift @@ -16,14 +16,10 @@ import UIKit let title = Label.commonLabelH3(true) let message = Label.commonLabelB3(true) - let button = ButtonView(frame: .zero) + let button = PrimaryButton.primaryTinyButton(false)! let imageloader = MFLoadImageView() let leftContainer = ViewConstrainingView.empty() - //------------------------------------------------------ - // MARK: - Constraints - //------------------------------------------------------ - //------------------------------------------------------ // MARK: - Initialization //------------------------------------------------------ @@ -54,17 +50,18 @@ import UIKit guard subviews.isEmpty else { return } + button.setAsSecondaryCustom() + addSubview(leftContainer) leftContainer.addSubview(title) leftContainer.addSubview(message) leftContainer.addSubview(button) addSubview(imageloader) + imageloader.imageView.contentMode = .scaleAspectFit imageloader.translatesAutoresizingMaskIntoConstraints = false button.translatesAutoresizingMaskIntoConstraints = false - imageloader.imageView.contentMode = .scaleAspectFit - leftContainer.topAnchor.constraint(equalTo: topAnchor).isActive = true leftContainer.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor).isActive = true @@ -76,28 +73,25 @@ import UIKit title.topAnchor.constraint(equalTo: topAnchor).isActive = true title.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true - title.widthAnchor.constraint(equalTo: leftContainer.widthAnchor).isActive = true message.topAnchor.constraint(equalTo: title.bottomAnchor, constant: 6).isActive = true message.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true - message.widthAnchor.constraint(equalTo: leftContainer.widthAnchor).isActive = true imageloader.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true layoutMarginsGuide.trailingAnchor.constraint(equalTo: imageloader.trailingAnchor).isActive = true imageloader.topAnchor.constraint(greaterThanOrEqualTo: topAnchor).isActive = true + imageloader.leadingAnchor.constraint(equalTo: leftContainer.trailingAnchor, constant: 16).isActive = true + bottomAnchor.constraint(greaterThanOrEqualTo: imageloader.bottomAnchor).isActive = true let imageloaderBottom = imageloader.bottomAnchor.constraint(equalTo: bottomAnchor) imageloaderBottom.priority = UILayoutPriority(249) imageloaderBottom.isActive = true - bottomAnchor.constraint(greaterThanOrEqualTo: imageloader.bottomAnchor).isActive = true - - imageloader.leadingAnchor.constraint(equalTo: leftContainer.trailingAnchor, constant: 16).isActive = true - button.topAnchor.constraint(equalTo: message.bottomAnchor, constant: 12).isActive = true button.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true + button.bottomAnchor.constraint(equalTo: leftContainer.bottomAnchor).isActive = true title.setContentHuggingPriority(UILayoutPriority(rawValue: 901), for: .horizontal) message.setContentHuggingPriority(UILayoutPriority(rawValue: 902), for: .horizontal) @@ -107,10 +101,18 @@ import UIKit title.setContentCompressionResistancePriority(.required, for: .vertical) message.setContentCompressionResistancePriority(.required, for: .vertical) + + imageloader.imageView.setContentCompressionResistancePriority(.required, for: .vertical) } override open func updateView(_ size: CGFloat) { super.updateView(size) + + title.updateView(size) + message.updateView(size) + button.updateView(size) + imageloader.updateView(size) + leftContainer.updateView(size) } override open func reset() { diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m index ebac9da4..0e8a8e77 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m +++ b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m @@ -43,7 +43,8 @@ @"listItem": MoleculeTableViewCell.class, @"switchLineItem": SwitchLineItem.class, @"switch": Switch.class, - @"leftRightLabelView": LeftRightLabelView.class + @"leftRightLabelView": LeftRightLabelView.class, + @"standardListItemWithImage": StandardListItemWithImage.class } mutableCopy]; }); return mapping; From dbeb5156c5e47602a162fe629a4a6ac3aa0a9cbf Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Wed, 26 Jun 2019 14:49:01 -0400 Subject: [PATCH 03/22] StandardListItemWithImage assembled. --- .../Views/StandardListItemWithImage.swift | 65 ++++++++++++------- 1 file changed, 42 insertions(+), 23 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift b/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift index 83ab4498..f35249ef 100644 --- a/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift +++ b/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift @@ -20,6 +20,14 @@ import UIKit let imageloader = MFLoadImageView() let leftContainer = ViewConstrainingView.empty() + //------------------------------------------------------ + // MARK: - Constraints + //------------------------------------------------------ + + var imageWidthConstraint: NSLayoutConstraint? + var imageHeightConstraint: NSLayoutConstraint? + var buttonTopConstraint: NSLayoutConstraint? + //------------------------------------------------------ // MARK: - Initialization //------------------------------------------------------ @@ -52,57 +60,59 @@ import UIKit button.setAsSecondaryCustom() + imageloader.imageView.contentMode = .scaleAspectFit + addSubview(leftContainer) + addSubview(imageloader) leftContainer.addSubview(title) leftContainer.addSubview(message) leftContainer.addSubview(button) - addSubview(imageloader) - - imageloader.imageView.contentMode = .scaleAspectFit - imageloader.translatesAutoresizingMaskIntoConstraints = false - button.translatesAutoresizingMaskIntoConstraints = false leftContainer.topAnchor.constraint(equalTo: topAnchor).isActive = true leftContainer.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor).isActive = true + bottomAnchor.constraint(greaterThanOrEqualTo: leftContainer.bottomAnchor).isActive = true let leftContainerBottom = leftContainer.bottomAnchor.constraint(equalTo: bottomAnchor) leftContainerBottom.priority = UILayoutPriority(249) leftContainerBottom.isActive = true - bottomAnchor.constraint(greaterThanOrEqualTo: leftContainer.bottomAnchor).isActive = true - - title.topAnchor.constraint(equalTo: topAnchor).isActive = true + title.topAnchor.constraint(equalTo: leftContainer.topAnchor).isActive = true title.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true + title.trailingAnchor.constraint(equalTo: leftContainer.trailingAnchor).isActive = true title.widthAnchor.constraint(equalTo: leftContainer.widthAnchor).isActive = true - message.topAnchor.constraint(equalTo: title.bottomAnchor, constant: 6).isActive = true + message.topAnchor.constraint(equalTo: title.bottomAnchor, constant: PaddingOne).isActive = true message.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true + message.trailingAnchor.constraint(equalTo: leftContainer.trailingAnchor).isActive = true message.widthAnchor.constraint(equalTo: leftContainer.widthAnchor).isActive = true + buttonTopConstraint = button.topAnchor.constraint(equalTo: message.bottomAnchor, constant: PaddingTwo) + buttonTopConstraint?.isActive = true + + button.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true + button.bottomAnchor.constraint(equalTo: leftContainer.bottomAnchor).isActive = true + leftContainer.trailingAnchor.constraint(greaterThanOrEqualTo: button.trailingAnchor).isActive = true + imageloader.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true layoutMarginsGuide.trailingAnchor.constraint(equalTo: imageloader.trailingAnchor).isActive = true - imageloader.topAnchor.constraint(greaterThanOrEqualTo: topAnchor).isActive = true imageloader.leadingAnchor.constraint(equalTo: leftContainer.trailingAnchor, constant: 16).isActive = true + imageHeightConstraint = imageloader.heightAnchor.constraint(equalToConstant: 0) + imageHeightConstraint?.isActive = true + + imageWidthConstraint = imageloader.widthAnchor.constraint(equalToConstant: 0) + imageWidthConstraint?.isActive = true + bottomAnchor.constraint(greaterThanOrEqualTo: imageloader.bottomAnchor).isActive = true let imageloaderBottom = imageloader.bottomAnchor.constraint(equalTo: bottomAnchor) imageloaderBottom.priority = UILayoutPriority(249) imageloaderBottom.isActive = true - button.topAnchor.constraint(equalTo: message.bottomAnchor, constant: 12).isActive = true - button.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true - button.bottomAnchor.constraint(equalTo: leftContainer.bottomAnchor).isActive = true - - title.setContentHuggingPriority(UILayoutPriority(rawValue: 901), for: .horizontal) - message.setContentHuggingPriority(UILayoutPriority(rawValue: 902), for: .horizontal) + title.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 901), for: .horizontal) + message.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 902), for: .horizontal) title.setContentHuggingPriority(.required, for: .vertical) message.setContentHuggingPriority(.required, for: .vertical) - - title.setContentCompressionResistancePriority(.required, for: .vertical) - message.setContentCompressionResistancePriority(.required, for: .vertical) - - imageloader.imageView.setContentCompressionResistancePriority(.required, for: .vertical) } override open func updateView(_ size: CGFloat) { @@ -113,6 +123,8 @@ import UIKit button.updateView(size) imageloader.updateView(size) leftContainer.updateView(size) + + buttonTopConstraint?.constant = message.hasText ? PaddingTwo : PaddingOne } override open func reset() { @@ -121,6 +133,7 @@ import UIKit title.text = "" message.text = "" imageloader.imageView.image = nil + imageWidthConstraint?.constant = 0 backgroundColor = nil } @@ -135,10 +148,16 @@ import UIKit imageloader.setWithJSON(dictionary.optionalDictionaryForKey("imageView"), delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData) if let imageJSON = dictionary.optionalDictionaryForKey("imageView") { + let width = CGFloat(imageJSON.floatForKey("width")) + let height = CGFloat(imageJSON.floatForKey("height")) + imageloader.loadImage(withName: imageJSON.optionalStringForKey("image"), format: imageJSON.optionalStringForKey("imageFormat"), - width: imageJSON.int32ForKey("imageWidth") as NSNumber, - height: imageJSON.int32ForKey("imageHeight") as NSNumber) + width: width as NSNumber, + height: height as NSNumber) + + imageWidthConstraint?.constant = width + imageHeightConstraint?.constant = height } if let backgroundColorHex = dictionary[KeyBackgroundColor] as? String { From b821250042b46d4a53a88be4d7b7d7c0595fc6de Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 1 Jul 2019 12:28:28 -0400 Subject: [PATCH 04/22] improvements made. --- .../Views/StandardListItemWithImage.swift | 54 +++++++++---------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift b/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift index f35249ef..7300daa2 100644 --- a/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift +++ b/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift @@ -27,6 +27,7 @@ import UIKit var imageWidthConstraint: NSLayoutConstraint? var imageHeightConstraint: NSLayoutConstraint? var buttonTopConstraint: NSLayoutConstraint? + var messageTopConstraint: NSLayoutConstraint? //------------------------------------------------------ // MARK: - Initialization @@ -44,7 +45,7 @@ import UIKit super.init(coder: aDecoder) } - public convenience init(json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) { + public convenience init(json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { self.init() setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) } @@ -79,12 +80,12 @@ import UIKit title.topAnchor.constraint(equalTo: leftContainer.topAnchor).isActive = true title.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true title.trailingAnchor.constraint(equalTo: leftContainer.trailingAnchor).isActive = true - title.widthAnchor.constraint(equalTo: leftContainer.widthAnchor).isActive = true - message.topAnchor.constraint(equalTo: title.bottomAnchor, constant: PaddingOne).isActive = true + messageTopConstraint = message.topAnchor.constraint(equalTo: title.bottomAnchor, constant: PaddingOne) + messageTopConstraint?.isActive = true + message.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true message.trailingAnchor.constraint(equalTo: leftContainer.trailingAnchor).isActive = true - message.widthAnchor.constraint(equalTo: leftContainer.widthAnchor).isActive = true buttonTopConstraint = button.topAnchor.constraint(equalTo: message.bottomAnchor, constant: PaddingTwo) buttonTopConstraint?.isActive = true @@ -96,10 +97,11 @@ import UIKit imageloader.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true layoutMarginsGuide.trailingAnchor.constraint(equalTo: imageloader.trailingAnchor).isActive = true imageloader.leadingAnchor.constraint(equalTo: leftContainer.trailingAnchor, constant: 16).isActive = true + imageloader.topAnchor.constraint(greaterThanOrEqualTo: topAnchor).isActive = true imageHeightConstraint = imageloader.heightAnchor.constraint(equalToConstant: 0) imageHeightConstraint?.isActive = true - + imageWidthConstraint = imageloader.widthAnchor.constraint(equalToConstant: 0) imageWidthConstraint?.isActive = true @@ -107,7 +109,7 @@ import UIKit let imageloaderBottom = imageloader.bottomAnchor.constraint(equalTo: bottomAnchor) imageloaderBottom.priority = UILayoutPriority(249) imageloaderBottom.isActive = true - + title.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 901), for: .horizontal) message.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 902), for: .horizontal) @@ -124,7 +126,15 @@ import UIKit imageloader.updateView(size) leftContainer.updateView(size) - buttonTopConstraint?.constant = message.hasText ? PaddingTwo : PaddingOne + messageTopConstraint?.constant = title.hasText ? PaddingOne : 0 + + if message.hasText { + buttonTopConstraint?.constant = PaddingTwo + } else if title.hasText { + buttonTopConstraint?.constant = PaddingOne + } else { + buttonTopConstraint?.constant = 0 + } } override open func reset() { @@ -137,31 +147,19 @@ import UIKit backgroundColor = nil } - open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) { - super.setWithJSON(json, delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData) + open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { + super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) guard let dictionary = json else { return } - title.setWithJSON(dictionary.optionalDictionaryForKey("title"), delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData) - message.setWithJSON(dictionary.optionalDictionaryForKey("message"), delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData) - button.setWithJSON(dictionary.optionalDictionaryForKey("button"), delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData) - imageloader.setWithJSON(dictionary.optionalDictionaryForKey("imageView"), delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData) + title.setWithJSON(dictionary.optionalDictionaryForKey("title"), delegateObject: delegateObject, additionalData: additionalData) + message.setWithJSON(dictionary.optionalDictionaryForKey("message"), delegateObject: delegateObject, additionalData: additionalData) + button.setWithJSON(dictionary.optionalDictionaryForKey("button"), delegateObject: delegateObject, additionalData: additionalData) + imageloader.setWithJSON(dictionary.optionalDictionaryForKey("image"), delegateObject: delegateObject, additionalData: additionalData) - if let imageJSON = dictionary.optionalDictionaryForKey("imageView") { - let width = CGFloat(imageJSON.floatForKey("width")) - let height = CGFloat(imageJSON.floatForKey("height")) - - imageloader.loadImage(withName: imageJSON.optionalStringForKey("image"), - format: imageJSON.optionalStringForKey("imageFormat"), - width: width as NSNumber, - height: height as NSNumber) - - imageWidthConstraint?.constant = width - imageHeightConstraint?.constant = height - } - - if let backgroundColorHex = dictionary[KeyBackgroundColor] as? String { - backgroundColor = UIColor.mfGet(forHex: backgroundColorHex) + if let imageJSON = dictionary.optionalDictionaryForKey("image") { + imageWidthConstraint?.constant = CGFloat(imageJSON.floatForKey("width")) + imageHeightConstraint?.constant = CGFloat(imageJSON.floatForKey("height")) } } } From ada34f6f13c19fa15d2fe06665f310176aaec60d Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 1 Jul 2019 13:16:14 -0400 Subject: [PATCH 05/22] condensed constraint command. --- MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift b/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift index 7300daa2..1c65b0bd 100644 --- a/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift +++ b/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift @@ -127,14 +127,7 @@ import UIKit leftContainer.updateView(size) messageTopConstraint?.constant = title.hasText ? PaddingOne : 0 - - if message.hasText { - buttonTopConstraint?.constant = PaddingTwo - } else if title.hasText { - buttonTopConstraint?.constant = PaddingOne - } else { - buttonTopConstraint?.constant = 0 - } + buttonTopConstraint?.constant = message.hasText ? PaddingTwo : (title.hasText ? PaddingOne : 0) } override open func reset() { From ce1a8c3598e9e236895739a60440ea72487d619b Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 8 Jul 2019 10:36:34 -0400 Subject: [PATCH 06/22] Renamed to comply with MFAtom design doc. --- MVMCoreUI.xcodeproj/project.pbxproj | 8 +- MVMCoreUI/Atoms/Views/ListItemWithImage.swift | 152 ++++++++++++++++++ .../MVMCoreUIMoleculeMappingObject.m | 2 +- 3 files changed, 157 insertions(+), 5 deletions(-) create mode 100644 MVMCoreUI/Atoms/Views/ListItemWithImage.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index ca3ea276..1f21b44e 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -18,7 +18,7 @@ 01DF55E021F8FAA800CC099B /* MFTextFieldListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01DF55DF21F8FAA800CC099B /* MFTextFieldListView.swift */; }; 01DF567021FA5AB300CC099B /* TextFieldListFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01DF566F21FA5AB300CC099B /* TextFieldListFormViewController.swift */; }; 01E569D3223FFFA500327251 /* ThreeLayerViewController.swift in Headers */ = {isa = PBXBuildFile; fileRef = D2A5146A2214905000345BFB /* ThreeLayerViewController.swift */; settings = {ATTRIBUTES = (Public, ); }; }; - 0A1214A022C11A18007C7030 /* StandardListItemWithImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A12149F22C11A17007C7030 /* StandardListItemWithImage.swift */; }; + 0A1214A022C11A18007C7030 /* ListItemWithImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A12149F22C11A17007C7030 /* ListItemWithImage.swift */; }; B8200E152280C4CF007245F4 /* ProgressBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8200E142280C4CF007245F4 /* ProgressBar.swift */; }; B8200E192281DC1A007245F4 /* ProgressBarWithLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8200E182281DC1A007245F4 /* ProgressBarWithLabel.swift */; }; D206997721FB8A0B00CAE0DE /* MVMCoreUINavigationController.h in Headers */ = {isa = PBXBuildFile; fileRef = D206997521FB8A0B00CAE0DE /* MVMCoreUINavigationController.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -187,7 +187,7 @@ 01CA51B4229716F60071A6EE /* Switch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Switch.swift; sourceTree = ""; }; 01DF55DF21F8FAA800CC099B /* MFTextFieldListView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MFTextFieldListView.swift; sourceTree = ""; }; 01DF566F21FA5AB300CC099B /* TextFieldListFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldListFormViewController.swift; sourceTree = ""; }; - 0A12149F22C11A17007C7030 /* StandardListItemWithImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StandardListItemWithImage.swift; sourceTree = ""; }; + 0A12149F22C11A17007C7030 /* ListItemWithImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListItemWithImage.swift; sourceTree = ""; }; B8200E142280C4CF007245F4 /* ProgressBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressBar.swift; sourceTree = ""; }; B8200E182281DC1A007245F4 /* ProgressBarWithLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressBarWithLabel.swift; sourceTree = ""; }; D206997521FB8A0B00CAE0DE /* MVMCoreUINavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUINavigationController.h; sourceTree = ""; }; @@ -623,7 +623,7 @@ D22D1F45220496A30077CEC0 /* MVMCoreUISwitch.m */, DBC4391C2245232D001AB423 /* LabelWithInternalButton.swift */, DB891E822253FA8500022516 /* Label.swift */, - 0A12149F22C11A17007C7030 /* StandardListItemWithImage.swift */, + 0A12149F22C11A17007C7030 /* ListItemWithImage.swift */, 0198F7A02256A80A0066C936 /* MFRadioButton.h */, 0198F7A22256A80A0066C936 /* MFRadioButton.m */, ); @@ -978,7 +978,7 @@ D29DF13221E6851E003B2FB9 /* MVMCoreUITopAlertBaseView.m in Sources */, D29DF29C21E7ADB9003B2FB9 /* MFProgrammaticTableViewController.m in Sources */, 0105618E224BBE7700E1557D /* FormValidator+TextFields.swift in Sources */, - 0A1214A022C11A18007C7030 /* StandardListItemWithImage.swift in Sources */, + 0A1214A022C11A18007C7030 /* ListItemWithImage.swift in Sources */, D29DF2BE21E7BEA4003B2FB9 /* TopTabbar.m in Sources */, D2A514632213643100345BFB /* MoleculeStackCenteredTemplate.swift in Sources */, D29DF32421ED0DA2003B2FB9 /* TextButtonView.m in Sources */, diff --git a/MVMCoreUI/Atoms/Views/ListItemWithImage.swift b/MVMCoreUI/Atoms/Views/ListItemWithImage.swift new file mode 100644 index 00000000..dfd80aef --- /dev/null +++ b/MVMCoreUI/Atoms/Views/ListItemWithImage.swift @@ -0,0 +1,152 @@ +// +// StandardListItemWithImage.swift +// MVMCoreUI +// +// Created by Christiano, Kevin on 6/20/19. +// Copyright © 2019 Verizon Wireless. All rights reserved. +// + +import UIKit + + +@objcMembers open class ListItemWithImage: ViewConstrainingView { + //------------------------------------------------------ + // MARK: - Outlets + //------------------------------------------------------ + + let title = Label.commonLabelH3(true) + let message = Label.commonLabelB3(true) + let button = PrimaryButton.primaryTinyButton(false)! + let imageloader = MFLoadImageView() + let leftContainer = ViewConstrainingView.empty() + + //------------------------------------------------------ + // MARK: - Constraints + //------------------------------------------------------ + + var imageWidthConstraint: NSLayoutConstraint? + var imageHeightConstraint: NSLayoutConstraint? + var buttonTopConstraint: NSLayoutConstraint? + var messageTopConstraint: NSLayoutConstraint? + + //------------------------------------------------------ + // MARK: - Initialization + //------------------------------------------------------ + + public init() { + super.init(frame: .zero) + } + + public override init(frame: CGRect) { + super.init(frame: frame) + } + + required public init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + } + + public convenience init(json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { + self.init() + setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) + } + + //------------------------------------------------------ + // MARK: - View Lifecycle + //------------------------------------------------------ + + override open func setupView() { + super.setupView() + + guard subviews.isEmpty else { return } + + button.setAsSecondaryCustom() + + imageloader.imageView.contentMode = .scaleAspectFit + + addSubview(leftContainer) + addSubview(imageloader) + leftContainer.addSubview(title) + leftContainer.addSubview(message) + leftContainer.addSubview(button) + + leftContainer.topAnchor.constraint(equalTo: topAnchor).isActive = true + leftContainer.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor).isActive = true + + bottomAnchor.constraint(greaterThanOrEqualTo: leftContainer.bottomAnchor).isActive = true + let leftContainerBottom = leftContainer.bottomAnchor.constraint(equalTo: bottomAnchor) + leftContainerBottom.priority = UILayoutPriority(249) + leftContainerBottom.isActive = true + + title.topAnchor.constraint(equalTo: leftContainer.topAnchor).isActive = true + title.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true + title.trailingAnchor.constraint(equalTo: leftContainer.trailingAnchor).isActive = true + + messageTopConstraint = message.topAnchor.constraint(equalTo: title.bottomAnchor, constant: PaddingOne) + messageTopConstraint?.isActive = true + + message.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true + message.trailingAnchor.constraint(equalTo: leftContainer.trailingAnchor).isActive = true + + buttonTopConstraint = button.topAnchor.constraint(equalTo: message.bottomAnchor, constant: PaddingTwo) + buttonTopConstraint?.isActive = true + + button.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true + button.bottomAnchor.constraint(equalTo: leftContainer.bottomAnchor).isActive = true + leftContainer.trailingAnchor.constraint(greaterThanOrEqualTo: button.trailingAnchor).isActive = true + + imageloader.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true + layoutMarginsGuide.trailingAnchor.constraint(equalTo: imageloader.trailingAnchor).isActive = true + imageloader.leadingAnchor.constraint(equalTo: leftContainer.trailingAnchor, constant: 16).isActive = true + imageloader.topAnchor.constraint(greaterThanOrEqualTo: topAnchor).isActive = true + + imageHeightConstraint = imageloader.heightAnchor.constraint(equalToConstant: 0) + imageHeightConstraint?.isActive = true + + imageWidthConstraint = imageloader.widthAnchor.constraint(equalToConstant: 0) + imageWidthConstraint?.isActive = true + + bottomAnchor.constraint(greaterThanOrEqualTo: imageloader.bottomAnchor).isActive = true + let imageloaderBottom = imageloader.bottomAnchor.constraint(equalTo: bottomAnchor) + imageloaderBottom.priority = UILayoutPriority(249) + imageloaderBottom.isActive = true + } + + override open func updateView(_ size: CGFloat) { + super.updateView(size) + + title.updateView(size) + message.updateView(size) + button.updateView(size) + imageloader.updateView(size) + leftContainer.updateView(size) + + messageTopConstraint?.constant = title.hasText ? PaddingOne : 0 + buttonTopConstraint?.constant = message.hasText ? PaddingTwo : (title.hasText ? PaddingOne : 0) + } + + override open func reset() { + super.reset() + + title.text = "" + message.text = "" + imageloader.imageView.image = nil + imageWidthConstraint?.constant = 0 + backgroundColor = nil + } + + open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { + super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) + + guard let dictionary = json else { return } + + title.setWithJSON(dictionary.optionalDictionaryForKey("title"), delegateObject: delegateObject, additionalData: additionalData) + message.setWithJSON(dictionary.optionalDictionaryForKey("message"), delegateObject: delegateObject, additionalData: additionalData) + button.setWithJSON(dictionary.optionalDictionaryForKey("button"), delegateObject: delegateObject, additionalData: additionalData) + imageloader.setWithJSON(dictionary.optionalDictionaryForKey("image"), delegateObject: delegateObject, additionalData: additionalData) + + if let imageJSON = dictionary.optionalDictionaryForKey("image") { + imageWidthConstraint?.constant = CGFloat(imageJSON.floatForKey("width")) + imageHeightConstraint?.constant = CGFloat(imageJSON.floatForKey("height")) + } + } +} diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m index 7367fd42..b125f74d 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m +++ b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m @@ -46,7 +46,7 @@ @"switchLineItem": SwitchLineItem.class, @"switch": Switch.class, @"leftRightLabelView": LeftRightLabelView.class, - @"standardListItemWithImage": StandardListItemWithImage.class, + @"listItemWithImage": ListItemWithImage.class, @"image": MFLoadImageView.class, @"moduleMolecule": ModuleMolecule.class } mutableCopy]; From 1bfbe95b68a703a93df48ce3fb120be5307d772a Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 8 Jul 2019 10:36:56 -0400 Subject: [PATCH 07/22] updated file name. --- .../Views/StandardListItemWithImage.swift | 158 ------------------ 1 file changed, 158 deletions(-) delete mode 100644 MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift diff --git a/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift b/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift deleted file mode 100644 index 1c65b0bd..00000000 --- a/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift +++ /dev/null @@ -1,158 +0,0 @@ -// -// StandardListItemWithImage.swift -// MVMCoreUI -// -// Created by Christiano, Kevin on 6/20/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -import UIKit - - -@objcMembers open class StandardListItemWithImage: ViewConstrainingView { - //------------------------------------------------------ - // MARK: - Outlets - //------------------------------------------------------ - - let title = Label.commonLabelH3(true) - let message = Label.commonLabelB3(true) - let button = PrimaryButton.primaryTinyButton(false)! - let imageloader = MFLoadImageView() - let leftContainer = ViewConstrainingView.empty() - - //------------------------------------------------------ - // MARK: - Constraints - //------------------------------------------------------ - - var imageWidthConstraint: NSLayoutConstraint? - var imageHeightConstraint: NSLayoutConstraint? - var buttonTopConstraint: NSLayoutConstraint? - var messageTopConstraint: NSLayoutConstraint? - - //------------------------------------------------------ - // MARK: - Initialization - //------------------------------------------------------ - - public init() { - super.init(frame: .zero) - } - - public override init(frame: CGRect) { - super.init(frame: frame) - } - - required public init?(coder aDecoder: NSCoder) { - super.init(coder: aDecoder) - } - - public convenience init(json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - self.init() - setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - } - - //------------------------------------------------------ - // MARK: - View Lifecycle - //------------------------------------------------------ - - override open func setupView() { - super.setupView() - - guard subviews.isEmpty else { return } - - button.setAsSecondaryCustom() - - imageloader.imageView.contentMode = .scaleAspectFit - - addSubview(leftContainer) - addSubview(imageloader) - leftContainer.addSubview(title) - leftContainer.addSubview(message) - leftContainer.addSubview(button) - - leftContainer.topAnchor.constraint(equalTo: topAnchor).isActive = true - leftContainer.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor).isActive = true - - bottomAnchor.constraint(greaterThanOrEqualTo: leftContainer.bottomAnchor).isActive = true - let leftContainerBottom = leftContainer.bottomAnchor.constraint(equalTo: bottomAnchor) - leftContainerBottom.priority = UILayoutPriority(249) - leftContainerBottom.isActive = true - - title.topAnchor.constraint(equalTo: leftContainer.topAnchor).isActive = true - title.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true - title.trailingAnchor.constraint(equalTo: leftContainer.trailingAnchor).isActive = true - - messageTopConstraint = message.topAnchor.constraint(equalTo: title.bottomAnchor, constant: PaddingOne) - messageTopConstraint?.isActive = true - - message.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true - message.trailingAnchor.constraint(equalTo: leftContainer.trailingAnchor).isActive = true - - buttonTopConstraint = button.topAnchor.constraint(equalTo: message.bottomAnchor, constant: PaddingTwo) - buttonTopConstraint?.isActive = true - - button.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true - button.bottomAnchor.constraint(equalTo: leftContainer.bottomAnchor).isActive = true - leftContainer.trailingAnchor.constraint(greaterThanOrEqualTo: button.trailingAnchor).isActive = true - - imageloader.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true - layoutMarginsGuide.trailingAnchor.constraint(equalTo: imageloader.trailingAnchor).isActive = true - imageloader.leadingAnchor.constraint(equalTo: leftContainer.trailingAnchor, constant: 16).isActive = true - imageloader.topAnchor.constraint(greaterThanOrEqualTo: topAnchor).isActive = true - - imageHeightConstraint = imageloader.heightAnchor.constraint(equalToConstant: 0) - imageHeightConstraint?.isActive = true - - imageWidthConstraint = imageloader.widthAnchor.constraint(equalToConstant: 0) - imageWidthConstraint?.isActive = true - - bottomAnchor.constraint(greaterThanOrEqualTo: imageloader.bottomAnchor).isActive = true - let imageloaderBottom = imageloader.bottomAnchor.constraint(equalTo: bottomAnchor) - imageloaderBottom.priority = UILayoutPriority(249) - imageloaderBottom.isActive = true - - title.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 901), for: .horizontal) - message.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 902), for: .horizontal) - - title.setContentHuggingPriority(.required, for: .vertical) - message.setContentHuggingPriority(.required, for: .vertical) - } - - override open func updateView(_ size: CGFloat) { - super.updateView(size) - - title.updateView(size) - message.updateView(size) - button.updateView(size) - imageloader.updateView(size) - leftContainer.updateView(size) - - messageTopConstraint?.constant = title.hasText ? PaddingOne : 0 - buttonTopConstraint?.constant = message.hasText ? PaddingTwo : (title.hasText ? PaddingOne : 0) - } - - override open func reset() { - super.reset() - - title.text = "" - message.text = "" - imageloader.imageView.image = nil - imageWidthConstraint?.constant = 0 - backgroundColor = nil - } - - open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - - guard let dictionary = json else { return } - - title.setWithJSON(dictionary.optionalDictionaryForKey("title"), delegateObject: delegateObject, additionalData: additionalData) - message.setWithJSON(dictionary.optionalDictionaryForKey("message"), delegateObject: delegateObject, additionalData: additionalData) - button.setWithJSON(dictionary.optionalDictionaryForKey("button"), delegateObject: delegateObject, additionalData: additionalData) - imageloader.setWithJSON(dictionary.optionalDictionaryForKey("image"), delegateObject: delegateObject, additionalData: additionalData) - - if let imageJSON = dictionary.optionalDictionaryForKey("image") { - imageWidthConstraint?.constant = CGFloat(imageJSON.floatForKey("width")) - imageHeightConstraint?.constant = CGFloat(imageJSON.floatForKey("height")) - } - } -} From ae7d757dbc2a8bdff3941eafc2e343506adf979e Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 9 Jul 2019 13:53:49 -0400 Subject: [PATCH 08/22] Updated variable name. removed padding if image is not there. --- MVMCoreUI/Atoms/Views/ListItemWithImage.swift | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/ListItemWithImage.swift b/MVMCoreUI/Atoms/Views/ListItemWithImage.swift index dfd80aef..dc0fc68a 100644 --- a/MVMCoreUI/Atoms/Views/ListItemWithImage.swift +++ b/MVMCoreUI/Atoms/Views/ListItemWithImage.swift @@ -17,7 +17,7 @@ import UIKit let title = Label.commonLabelH3(true) let message = Label.commonLabelB3(true) let button = PrimaryButton.primaryTinyButton(false)! - let imageloader = MFLoadImageView() + let imageLoader = MFLoadImageView() let leftContainer = ViewConstrainingView.empty() //------------------------------------------------------ @@ -26,6 +26,7 @@ import UIKit var imageWidthConstraint: NSLayoutConstraint? var imageHeightConstraint: NSLayoutConstraint? + var imageLeadingConstraint: NSLayoutConstraint? var buttonTopConstraint: NSLayoutConstraint? var messageTopConstraint: NSLayoutConstraint? @@ -60,11 +61,10 @@ import UIKit guard subviews.isEmpty else { return } button.setAsSecondaryCustom() - - imageloader.imageView.contentMode = .scaleAspectFit + imageLoader.imageView.contentMode = .scaleAspectFit addSubview(leftContainer) - addSubview(imageloader) + addSubview(imageLoader) leftContainer.addSubview(title) leftContainer.addSubview(message) leftContainer.addSubview(button) @@ -94,19 +94,20 @@ import UIKit button.bottomAnchor.constraint(equalTo: leftContainer.bottomAnchor).isActive = true leftContainer.trailingAnchor.constraint(greaterThanOrEqualTo: button.trailingAnchor).isActive = true - imageloader.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true - layoutMarginsGuide.trailingAnchor.constraint(equalTo: imageloader.trailingAnchor).isActive = true - imageloader.leadingAnchor.constraint(equalTo: leftContainer.trailingAnchor, constant: 16).isActive = true - imageloader.topAnchor.constraint(greaterThanOrEqualTo: topAnchor).isActive = true + imageLoader.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true + layoutMarginsGuide.trailingAnchor.constraint(equalTo: imageLoader.trailingAnchor).isActive = true + imageLeadingConstraint = imageLoader.leadingAnchor.constraint(greaterThanOrEqualTo: leftContainer.trailingAnchor, constant: 16) + imageLeadingConstraint?.isActive = true + imageLoader.topAnchor.constraint(greaterThanOrEqualTo: topAnchor).isActive = true - imageHeightConstraint = imageloader.heightAnchor.constraint(equalToConstant: 0) + imageHeightConstraint = imageLoader.heightAnchor.constraint(equalToConstant: 0) imageHeightConstraint?.isActive = true - - imageWidthConstraint = imageloader.widthAnchor.constraint(equalToConstant: 0) + + imageWidthConstraint = imageLoader.widthAnchor.constraint(equalToConstant: 0) imageWidthConstraint?.isActive = true - bottomAnchor.constraint(greaterThanOrEqualTo: imageloader.bottomAnchor).isActive = true - let imageloaderBottom = imageloader.bottomAnchor.constraint(equalTo: bottomAnchor) + bottomAnchor.constraint(greaterThanOrEqualTo: imageLoader.bottomAnchor).isActive = true + let imageloaderBottom = imageLoader.bottomAnchor.constraint(equalTo: bottomAnchor) imageloaderBottom.priority = UILayoutPriority(249) imageloaderBottom.isActive = true } @@ -117,11 +118,15 @@ import UIKit title.updateView(size) message.updateView(size) button.updateView(size) - imageloader.updateView(size) + imageLoader.updateView(size) leftContainer.updateView(size) messageTopConstraint?.constant = title.hasText ? PaddingOne : 0 buttonTopConstraint?.constant = message.hasText ? PaddingTwo : (title.hasText ? PaddingOne : 0) + + if imageWidthConstraint?.constant == 0 { + imageLeadingConstraint?.constant = 0 + } } override open func reset() { @@ -129,8 +134,9 @@ import UIKit title.text = "" message.text = "" - imageloader.imageView.image = nil + imageLoader.imageView.image = nil imageWidthConstraint?.constant = 0 + imageLeadingConstraint?.constant = 16 backgroundColor = nil } @@ -142,7 +148,7 @@ import UIKit title.setWithJSON(dictionary.optionalDictionaryForKey("title"), delegateObject: delegateObject, additionalData: additionalData) message.setWithJSON(dictionary.optionalDictionaryForKey("message"), delegateObject: delegateObject, additionalData: additionalData) button.setWithJSON(dictionary.optionalDictionaryForKey("button"), delegateObject: delegateObject, additionalData: additionalData) - imageloader.setWithJSON(dictionary.optionalDictionaryForKey("image"), delegateObject: delegateObject, additionalData: additionalData) + imageLoader.setWithJSON(dictionary.optionalDictionaryForKey("image"), delegateObject: delegateObject, additionalData: additionalData) if let imageJSON = dictionary.optionalDictionaryForKey("image") { imageWidthConstraint?.constant = CGFloat(imageJSON.floatForKey("width")) From 9444df4d7c2112bffb717e1b8d3f6c943c6bf30f Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 16 Jul 2019 10:25:53 -0400 Subject: [PATCH 09/22] latest take on listitemwithimage. --- MVMCoreUI/Atoms/Views/ListItemWithImage.swift | 32 ++++++------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/ListItemWithImage.swift b/MVMCoreUI/Atoms/Views/ListItemWithImage.swift index dc0fc68a..334020e4 100644 --- a/MVMCoreUI/Atoms/Views/ListItemWithImage.swift +++ b/MVMCoreUI/Atoms/Views/ListItemWithImage.swift @@ -17,15 +17,13 @@ import UIKit let title = Label.commonLabelH3(true) let message = Label.commonLabelB3(true) let button = PrimaryButton.primaryTinyButton(false)! - let imageLoader = MFLoadImageView() + let imageLoader = MFLoadImageView(pinnedEdges: .all) let leftContainer = ViewConstrainingView.empty() //------------------------------------------------------ // MARK: - Constraints //------------------------------------------------------ - var imageWidthConstraint: NSLayoutConstraint? - var imageHeightConstraint: NSLayoutConstraint? var imageLeadingConstraint: NSLayoutConstraint? var buttonTopConstraint: NSLayoutConstraint? var messageTopConstraint: NSLayoutConstraint? @@ -58,6 +56,8 @@ import UIKit override open func setupView() { super.setupView() + imageLoader.addSizeConstraintsForAspectRatio = true + guard subviews.isEmpty else { return } button.setAsSecondaryCustom() @@ -96,16 +96,10 @@ import UIKit imageLoader.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true layoutMarginsGuide.trailingAnchor.constraint(equalTo: imageLoader.trailingAnchor).isActive = true - imageLeadingConstraint = imageLoader.leadingAnchor.constraint(greaterThanOrEqualTo: leftContainer.trailingAnchor, constant: 16) + imageLeadingConstraint = imageLoader.leadingAnchor.constraint(equalTo: leftContainer.trailingAnchor, constant: 16) imageLeadingConstraint?.isActive = true imageLoader.topAnchor.constraint(greaterThanOrEqualTo: topAnchor).isActive = true - imageHeightConstraint = imageLoader.heightAnchor.constraint(equalToConstant: 0) - imageHeightConstraint?.isActive = true - - imageWidthConstraint = imageLoader.widthAnchor.constraint(equalToConstant: 0) - imageWidthConstraint?.isActive = true - bottomAnchor.constraint(greaterThanOrEqualTo: imageLoader.bottomAnchor).isActive = true let imageloaderBottom = imageLoader.bottomAnchor.constraint(equalTo: bottomAnchor) imageloaderBottom.priority = UILayoutPriority(249) @@ -114,7 +108,7 @@ import UIKit override open func updateView(_ size: CGFloat) { super.updateView(size) - + title.updateView(size) message.updateView(size) button.updateView(size) @@ -123,19 +117,18 @@ import UIKit messageTopConstraint?.constant = title.hasText ? PaddingOne : 0 buttonTopConstraint?.constant = message.hasText ? PaddingTwo : (title.hasText ? PaddingOne : 0) - - if imageWidthConstraint?.constant == 0 { - imageLeadingConstraint?.constant = 0 - } } + //------------------------------------------------------ + // MARK: - Methods + //------------------------------------------------------ + override open func reset() { super.reset() title.text = "" message.text = "" imageLoader.imageView.image = nil - imageWidthConstraint?.constant = 0 imageLeadingConstraint?.constant = 16 backgroundColor = nil } @@ -144,15 +137,10 @@ import UIKit super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) guard let dictionary = json else { return } - + title.setWithJSON(dictionary.optionalDictionaryForKey("title"), delegateObject: delegateObject, additionalData: additionalData) message.setWithJSON(dictionary.optionalDictionaryForKey("message"), delegateObject: delegateObject, additionalData: additionalData) button.setWithJSON(dictionary.optionalDictionaryForKey("button"), delegateObject: delegateObject, additionalData: additionalData) imageLoader.setWithJSON(dictionary.optionalDictionaryForKey("image"), delegateObject: delegateObject, additionalData: additionalData) - - if let imageJSON = dictionary.optionalDictionaryForKey("image") { - imageWidthConstraint?.constant = CGFloat(imageJSON.floatForKey("width")) - imageHeightConstraint?.constant = CGFloat(imageJSON.floatForKey("height")) - } } } From 7472533bc12667d9cb0809eaff36fc6b4e596b76 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 23 Jul 2019 10:13:44 -0400 Subject: [PATCH 10/22] fixes error alert. --- MVMCoreUI/Templates/MoleculeStackTemplate.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/MVMCoreUI/Templates/MoleculeStackTemplate.swift b/MVMCoreUI/Templates/MoleculeStackTemplate.swift index 064c910c..d6f78b05 100644 --- a/MVMCoreUI/Templates/MoleculeStackTemplate.swift +++ b/MVMCoreUI/Templates/MoleculeStackTemplate.swift @@ -8,7 +8,7 @@ import UIKit -public class MoleculeStackTemplate: ThreeLayerViewController { +open class MoleculeStackTemplate: ThreeLayerViewController { var observer: NSKeyValueObservation? open override var loadObject: MVMCoreLoadObject? { @@ -25,18 +25,18 @@ public class MoleculeStackTemplate: ThreeLayerViewController { } } - public override func spaceBetweenTopAndMiddle() -> CGFloat? { + open override func spaceBetweenTopAndMiddle() -> CGFloat? { return 0 } - public override func viewForTop() -> UIView? { + open override func viewForTop() -> UIView? { guard let moleculeJSON = loadObject?.pageJSON?.optionalDictionaryForKey("header"), let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(forJSON: moleculeJSON, delegateObject: delegateObject() as? MVMCoreUIDelegateObject, constrainIfNeeded: true) else { return nil } return molecule } - public override func viewForMiddle() -> UIView? { + open override func viewForMiddle() -> UIView? { guard let moleculeJSON = loadObject?.pageJSON?.optionalDictionaryForKey("moleculeStack") else { return nil } @@ -46,7 +46,7 @@ public class MoleculeStackTemplate: ThreeLayerViewController { return stack } - override public func viewForBottom() -> UIView? { + override open func viewForBottom() -> UIView? { guard let moleculeJSON = loadObject?.pageJSON?.optionalDictionaryForKey("footer"), let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(forJSON: moleculeJSON, delegateObject: delegateObject() as? MVMCoreUIDelegateObject, constrainIfNeeded: true) else { return nil } @@ -54,14 +54,14 @@ public class MoleculeStackTemplate: ThreeLayerViewController { } // MARK: - cache handling - public override func pageTypesToListenFor() -> [Any]? { + open override func pageTypesToListenFor() -> [Any]? { guard let pageType = self.pageType else { return super.pageTypesToListenFor() } return [pageType] } - public override func modulesToListenFor() -> [Any]? { + open override func modulesToListenFor() -> [Any]? { return loadObject?.requestParameters?.modules } From bc516ff74c5da768bc239dcbf716caeb9b288fe6 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 23 Jul 2019 12:14:18 -0400 Subject: [PATCH 11/22] removed statement causing loop. --- MVMCoreUI/Atoms/Views/ListItemWithImage.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/MVMCoreUI/Atoms/Views/ListItemWithImage.swift b/MVMCoreUI/Atoms/Views/ListItemWithImage.swift index 334020e4..0caa08d2 100644 --- a/MVMCoreUI/Atoms/Views/ListItemWithImage.swift +++ b/MVMCoreUI/Atoms/Views/ListItemWithImage.swift @@ -128,7 +128,6 @@ import UIKit title.text = "" message.text = "" - imageLoader.imageView.image = nil imageLeadingConstraint?.constant = 16 backgroundColor = nil } From 00f31524720e581a6c580679d34a7f64d3d81df9 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Wed, 31 Jul 2019 12:03:54 -0400 Subject: [PATCH 12/22] reversed trailing anchor constraints. --- MVMCoreUI/Atoms/Views/ListItemWithImage.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/ListItemWithImage.swift b/MVMCoreUI/Atoms/Views/ListItemWithImage.swift index 0caa08d2..5a383452 100644 --- a/MVMCoreUI/Atoms/Views/ListItemWithImage.swift +++ b/MVMCoreUI/Atoms/Views/ListItemWithImage.swift @@ -79,13 +79,13 @@ import UIKit title.topAnchor.constraint(equalTo: leftContainer.topAnchor).isActive = true title.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true - title.trailingAnchor.constraint(equalTo: leftContainer.trailingAnchor).isActive = true + leftContainer.trailingAnchor.constraint(equalTo: title.trailingAnchor).isActive = true messageTopConstraint = message.topAnchor.constraint(equalTo: title.bottomAnchor, constant: PaddingOne) messageTopConstraint?.isActive = true message.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true - message.trailingAnchor.constraint(equalTo: leftContainer.trailingAnchor).isActive = true + leftContainer.trailingAnchor.constraint(equalTo: message.trailingAnchor).isActive = true buttonTopConstraint = button.topAnchor.constraint(equalTo: message.bottomAnchor, constant: PaddingTwo) buttonTopConstraint?.isActive = true From dd05284b95e1dbb0e0099e58256ce425a9008682 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 5 Aug 2019 09:09:57 -0400 Subject: [PATCH 13/22] latest updates. --- MVMCoreUI/Atoms/Views/ListItemWithImage.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/ListItemWithImage.swift b/MVMCoreUI/Atoms/Views/ListItemWithImage.swift index 5a383452..55b63edb 100644 --- a/MVMCoreUI/Atoms/Views/ListItemWithImage.swift +++ b/MVMCoreUI/Atoms/Views/ListItemWithImage.swift @@ -1,5 +1,5 @@ // -// StandardListItemWithImage.swift +// ListItemWithImage.swift // MVMCoreUI // // Created by Christiano, Kevin on 6/20/19. @@ -69,7 +69,7 @@ import UIKit leftContainer.addSubview(message) leftContainer.addSubview(button) - leftContainer.topAnchor.constraint(equalTo: topAnchor).isActive = true + leftContainer.topAnchor.constraint(equalTo: layoutMarginsGuide.topAnchor).isActive = true leftContainer.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor).isActive = true bottomAnchor.constraint(greaterThanOrEqualTo: leftContainer.bottomAnchor).isActive = true @@ -91,17 +91,17 @@ import UIKit buttonTopConstraint?.isActive = true button.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true - button.bottomAnchor.constraint(equalTo: leftContainer.bottomAnchor).isActive = true + leftContainer.bottomAnchor.constraint(equalTo: button.bottomAnchor).isActive = true leftContainer.trailingAnchor.constraint(greaterThanOrEqualTo: button.trailingAnchor).isActive = true imageLoader.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true layoutMarginsGuide.trailingAnchor.constraint(equalTo: imageLoader.trailingAnchor).isActive = true imageLeadingConstraint = imageLoader.leadingAnchor.constraint(equalTo: leftContainer.trailingAnchor, constant: 16) imageLeadingConstraint?.isActive = true - imageLoader.topAnchor.constraint(greaterThanOrEqualTo: topAnchor).isActive = true + imageLoader.topAnchor.constraint(greaterThanOrEqualTo: layoutMarginsGuide.topAnchor).isActive = true - bottomAnchor.constraint(greaterThanOrEqualTo: imageLoader.bottomAnchor).isActive = true - let imageloaderBottom = imageLoader.bottomAnchor.constraint(equalTo: bottomAnchor) + layoutMarginsGuide.bottomAnchor.constraint(greaterThanOrEqualTo: imageLoader.bottomAnchor).isActive = true + let imageloaderBottom = imageLoader.bottomAnchor.constraint(equalTo: layoutMarginsGuide.bottomAnchor) imageloaderBottom.priority = UILayoutPriority(249) imageloaderBottom.isActive = true } From f2d557098946d628d561c57fd318d84aac3ae66b Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 5 Aug 2019 09:58:43 -0400 Subject: [PATCH 14/22] layoutMarginsGuide. --- MVMCoreUI/Atoms/Views/ListItemWithImage.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atoms/Views/ListItemWithImage.swift b/MVMCoreUI/Atoms/Views/ListItemWithImage.swift index 55b63edb..7e6599bc 100644 --- a/MVMCoreUI/Atoms/Views/ListItemWithImage.swift +++ b/MVMCoreUI/Atoms/Views/ListItemWithImage.swift @@ -72,7 +72,7 @@ import UIKit leftContainer.topAnchor.constraint(equalTo: layoutMarginsGuide.topAnchor).isActive = true leftContainer.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor).isActive = true - bottomAnchor.constraint(greaterThanOrEqualTo: leftContainer.bottomAnchor).isActive = true + layoutMarginsGuide.bottomAnchor.constraint(greaterThanOrEqualTo: leftContainer.bottomAnchor).isActive = true let leftContainerBottom = leftContainer.bottomAnchor.constraint(equalTo: bottomAnchor) leftContainerBottom.priority = UILayoutPriority(249) leftContainerBottom.isActive = true From 519542d3e5add737e8a6afd67e7e616f1b41c103 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 5 Aug 2019 10:09:11 -0400 Subject: [PATCH 15/22] Renamed class. --- MVMCoreUI.xcodeproj/project.pbxproj | 10 ++++------ ...ItemWithImage.swift => ActionDetailWithImage.swift} | 4 ++-- .../OtherHandlers/MVMCoreUIMoleculeMappingObject.m | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) rename MVMCoreUI/Atoms/Views/{ListItemWithImage.swift => ActionDetailWithImage.swift} (98%) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index b5415a3a..a0b4ef65 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -18,8 +18,7 @@ 01DF55E021F8FAA800CC099B /* MFTextFieldListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01DF55DF21F8FAA800CC099B /* MFTextFieldListView.swift */; }; 01DF567021FA5AB300CC099B /* TextFieldListFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01DF566F21FA5AB300CC099B /* TextFieldListFormViewController.swift */; }; 01E569D3223FFFA500327251 /* ThreeLayerViewController.swift in Headers */ = {isa = PBXBuildFile; fileRef = D2A5146A2214905000345BFB /* ThreeLayerViewController.swift */; settings = {ATTRIBUTES = (Public, ); }; }; - 0A1214A022C11A18007C7030 /* ListItemWithImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A12149F22C11A17007C7030 /* ListItemWithImage.swift */; }; - 18423C7E22E07B260069C7B7 /* MultiLabelListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18423C7D22E07B260069C7B7 /* MultiLabelListItem.swift */; }; + 0A1214A022C11A18007C7030 /* ActionDetailWithImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A12149F22C11A17007C7030 /* ActionDetailWithImage.swift */; }; B8200E152280C4CF007245F4 /* ProgressBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8200E142280C4CF007245F4 /* ProgressBar.swift */; }; B8200E192281DC1A007245F4 /* ProgressBarWithLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8200E182281DC1A007245F4 /* ProgressBarWithLabel.swift */; }; D206997721FB8A0B00CAE0DE /* MVMCoreUINavigationController.h in Headers */ = {isa = PBXBuildFile; fileRef = D206997521FB8A0B00CAE0DE /* MVMCoreUINavigationController.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -197,8 +196,7 @@ 01CA51B4229716F60071A6EE /* Switch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Switch.swift; sourceTree = ""; }; 01DF55DF21F8FAA800CC099B /* MFTextFieldListView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MFTextFieldListView.swift; sourceTree = ""; }; 01DF566F21FA5AB300CC099B /* TextFieldListFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldListFormViewController.swift; sourceTree = ""; }; - 0A12149F22C11A17007C7030 /* ListItemWithImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListItemWithImage.swift; sourceTree = ""; }; - 18423C7D22E07B260069C7B7 /* MultiLabelListItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MultiLabelListItem.swift; sourceTree = ""; }; + 0A12149F22C11A17007C7030 /* ActionDetailWithImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActionDetailWithImage.swift; sourceTree = ""; }; B8200E142280C4CF007245F4 /* ProgressBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressBar.swift; sourceTree = ""; }; B8200E182281DC1A007245F4 /* ProgressBarWithLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressBarWithLabel.swift; sourceTree = ""; }; D206997521FB8A0B00CAE0DE /* MVMCoreUINavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUINavigationController.h; sourceTree = ""; }; @@ -652,7 +650,7 @@ D22D1F45220496A30077CEC0 /* MVMCoreUISwitch.m */, DBC4391C2245232D001AB423 /* LabelWithInternalButton.swift */, DB891E822253FA8500022516 /* Label.swift */, - 0A12149F22C11A17007C7030 /* ListItemWithImage.swift */, + 0A12149F22C11A17007C7030 /* ActionDetailWithImage.swift */, 0198F7A02256A80A0066C936 /* MFRadioButton.h */, 0198F7A22256A80A0066C936 /* MFRadioButton.m */, ); @@ -1016,7 +1014,7 @@ D29DF13221E6851E003B2FB9 /* MVMCoreUITopAlertBaseView.m in Sources */, D29DF29C21E7ADB9003B2FB9 /* MFProgrammaticTableViewController.m in Sources */, 0105618E224BBE7700E1557D /* FormValidator+TextFields.swift in Sources */, - 0A1214A022C11A18007C7030 /* ListItemWithImage.swift in Sources */, + 0A1214A022C11A18007C7030 /* ActionDetailWithImage.swift in Sources */, D29DF2BE21E7BEA4003B2FB9 /* TopTabbar.m in Sources */, D2A514632213643100345BFB /* MoleculeStackCenteredTemplate.swift in Sources */, D29DF32421ED0DA2003B2FB9 /* TextButtonView.m in Sources */, diff --git a/MVMCoreUI/Atoms/Views/ListItemWithImage.swift b/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift similarity index 98% rename from MVMCoreUI/Atoms/Views/ListItemWithImage.swift rename to MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift index 7e6599bc..27d7e7d1 100644 --- a/MVMCoreUI/Atoms/Views/ListItemWithImage.swift +++ b/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift @@ -1,5 +1,5 @@ // -// ListItemWithImage.swift +// ActionDetailWithImage.swift // MVMCoreUI // // Created by Christiano, Kevin on 6/20/19. @@ -9,7 +9,7 @@ import UIKit -@objcMembers open class ListItemWithImage: ViewConstrainingView { +@objcMembers open class ActionDetailWithImage: ViewConstrainingView { //------------------------------------------------------ // MARK: - Outlets //------------------------------------------------------ diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m index bdf4a673..cd829697 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m +++ b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m @@ -47,7 +47,7 @@ @"switchLineItem": SwitchLineItem.class, @"switch": Switch.class, @"leftRightLabelView": LeftRightLabelView.class, - @"listItemWithImage": ListItemWithImage.class, + @"actionDetailWithImage": ActionDetailWithImage.class, @"image": MFLoadImageView.class, @"moduleMolecule": ModuleMolecule.class, @"headlineBody": HeadlineBody.class, From 93ed26820d9898907aa59b5cf8856092a7381982 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 5 Aug 2019 16:37:27 -0400 Subject: [PATCH 16/22] Latest State --- .../Atoms/Views/ActionDetailWithImage.swift | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift b/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift index 27d7e7d1..950e9b4c 100644 --- a/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift +++ b/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift @@ -20,6 +20,12 @@ import UIKit let imageLoader = MFLoadImageView(pinnedEdges: .all) let leftContainer = ViewConstrainingView.empty() + //------------------------------------------------------ + // MARK: - Properties + //------------------------------------------------------ + + var textPadding: CGFloat = PaddingOne + //------------------------------------------------------ // MARK: - Constraints //------------------------------------------------------ @@ -104,6 +110,18 @@ import UIKit let imageloaderBottom = imageLoader.bottomAnchor.constraint(equalTo: layoutMarginsGuide.bottomAnchor) imageloaderBottom.priority = UILayoutPriority(249) imageloaderBottom.isActive = true + +// title.widthAnchor.constraint(equalTo: leftContainer.widthAnchor).isActive = true +// message.widthAnchor.constraint(equalTo: leftContainer.widthAnchor).isActive = true + +// title.setContentCompressionResistancePriority(UILayoutPriority(970), for: .horizontal) +// title.setContentCompressionResistancePriority(.required, for: .vertical) +// message.setContentCompressionResistancePriority(UILayoutPriority(970), for: .horizontal) +// message.setContentCompressionResistancePriority(.required, for: .vertical) +// button.setContentCompressionResistancePriority(UILayoutPriority(976), for: .horizontal) +// button.setContentCompressionResistancePriority(.required, for: .vertical) +// imageLoader.loadingSpinner.setContentCompressionResistancePriority(UILayoutPriority(975), for: .horizontal) +// imageLoader.imageView.setContentCompressionResistancePriority(UILayoutPriority(975), for: .horizontal) } override open func updateView(_ size: CGFloat) { @@ -115,8 +133,13 @@ import UIKit imageLoader.updateView(size) leftContainer.updateView(size) - messageTopConstraint?.constant = title.hasText ? PaddingOne : 0 - buttonTopConstraint?.constant = message.hasText ? PaddingTwo : (title.hasText ? PaddingOne : 0) + let titlePadding = title.hasText ? textPadding : 0 + messageTopConstraint?.constant = titlePadding + buttonTopConstraint?.constant = message.hasText ? PaddingTwo : titlePadding + } + + public override static func estimatedHeight(forRow json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { + return 197 } //------------------------------------------------------ @@ -132,6 +155,10 @@ import UIKit backgroundColor = nil } + open override func setAsMolecule() { + super.setAsMolecule() + } + open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) @@ -141,5 +168,6 @@ import UIKit message.setWithJSON(dictionary.optionalDictionaryForKey("message"), delegateObject: delegateObject, additionalData: additionalData) button.setWithJSON(dictionary.optionalDictionaryForKey("button"), delegateObject: delegateObject, additionalData: additionalData) imageLoader.setWithJSON(dictionary.optionalDictionaryForKey("image"), delegateObject: delegateObject, additionalData: additionalData) + } } From f78a952905b655e12e85d2e56c99d37cafd5c2e8 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Fri, 9 Aug 2019 15:22:49 -0400 Subject: [PATCH 17/22] space. --- MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift b/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift index 950e9b4c..fa718a4e 100644 --- a/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift +++ b/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift @@ -168,6 +168,5 @@ import UIKit message.setWithJSON(dictionary.optionalDictionaryForKey("message"), delegateObject: delegateObject, additionalData: additionalData) button.setWithJSON(dictionary.optionalDictionaryForKey("button"), delegateObject: delegateObject, additionalData: additionalData) imageLoader.setWithJSON(dictionary.optionalDictionaryForKey("image"), delegateObject: delegateObject, additionalData: additionalData) - } } From 4fc5ff931347a4b83c29f6ba0200bfb0209d156e Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 12 Aug 2019 09:04:18 -0400 Subject: [PATCH 18/22] adjustments made. --- .../Atoms/Views/ActionDetailWithImage.swift | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift b/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift index fa718a4e..b1b092ec 100644 --- a/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift +++ b/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift @@ -102,7 +102,7 @@ import UIKit imageLoader.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true layoutMarginsGuide.trailingAnchor.constraint(equalTo: imageLoader.trailingAnchor).isActive = true - imageLeadingConstraint = imageLoader.leadingAnchor.constraint(equalTo: leftContainer.trailingAnchor, constant: 16) + imageLeadingConstraint = imageLoader.leadingAnchor.constraint(greaterThanOrEqualTo: leftContainer.trailingAnchor, constant: 16) imageLeadingConstraint?.isActive = true imageLoader.topAnchor.constraint(greaterThanOrEqualTo: layoutMarginsGuide.topAnchor).isActive = true @@ -110,18 +110,6 @@ import UIKit let imageloaderBottom = imageLoader.bottomAnchor.constraint(equalTo: layoutMarginsGuide.bottomAnchor) imageloaderBottom.priority = UILayoutPriority(249) imageloaderBottom.isActive = true - -// title.widthAnchor.constraint(equalTo: leftContainer.widthAnchor).isActive = true -// message.widthAnchor.constraint(equalTo: leftContainer.widthAnchor).isActive = true - -// title.setContentCompressionResistancePriority(UILayoutPriority(970), for: .horizontal) -// title.setContentCompressionResistancePriority(.required, for: .vertical) -// message.setContentCompressionResistancePriority(UILayoutPriority(970), for: .horizontal) -// message.setContentCompressionResistancePriority(.required, for: .vertical) -// button.setContentCompressionResistancePriority(UILayoutPriority(976), for: .horizontal) -// button.setContentCompressionResistancePriority(.required, for: .vertical) -// imageLoader.loadingSpinner.setContentCompressionResistancePriority(UILayoutPriority(975), for: .horizontal) -// imageLoader.imageView.setContentCompressionResistancePriority(UILayoutPriority(975), for: .horizontal) } override open func updateView(_ size: CGFloat) { @@ -152,7 +140,7 @@ import UIKit title.text = "" message.text = "" imageLeadingConstraint?.constant = 16 - backgroundColor = nil + imageLoader.reset() } open override func setAsMolecule() { @@ -163,6 +151,8 @@ import UIKit super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) guard let dictionary = json else { return } + + textPadding = dictionary.optionalCGFloatForKey("textPadding") ?? 0.0 title.setWithJSON(dictionary.optionalDictionaryForKey("title"), delegateObject: delegateObject, additionalData: additionalData) message.setWithJSON(dictionary.optionalDictionaryForKey("message"), delegateObject: delegateObject, additionalData: additionalData) From 57f82aa60a78eaae5e590a0d6282132c4de752f0 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 12 Aug 2019 09:40:15 -0400 Subject: [PATCH 19/22] Call super reset in vcv. Further adjustments to atom. --- .../Atoms/Views/ActionDetailWithImage.swift | 23 ++++++++++++------- MVMCoreUI/Atoms/Views/ViewConstrainingView.m | 1 + 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift b/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift index b1b092ec..5e32bc00 100644 --- a/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift +++ b/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift @@ -24,7 +24,7 @@ import UIKit // MARK: - Properties //------------------------------------------------------ - var textPadding: CGFloat = PaddingOne + var titlePadding: CGFloat = PaddingOne //------------------------------------------------------ // MARK: - Constraints @@ -62,12 +62,12 @@ import UIKit override open func setupView() { super.setupView() - imageLoader.addSizeConstraintsForAspectRatio = true - guard subviews.isEmpty else { return } button.setAsSecondaryCustom() + button.isHidden = false imageLoader.imageView.contentMode = .scaleAspectFit + imageLoader.addSizeConstraintsForAspectRatio = true addSubview(leftContainer) addSubview(imageLoader) @@ -121,9 +121,9 @@ import UIKit imageLoader.updateView(size) leftContainer.updateView(size) - let titlePadding = title.hasText ? textPadding : 0 - messageTopConstraint?.constant = titlePadding - buttonTopConstraint?.constant = message.hasText ? PaddingTwo : titlePadding + let topPadding = title.hasText ? titlePadding : 0 + messageTopConstraint?.constant = topPadding + buttonTopConstraint?.constant = message.hasText ? PaddingTwo : topPadding } public override static func estimatedHeight(forRow json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { @@ -152,11 +152,18 @@ import UIKit guard let dictionary = json else { return } - textPadding = dictionary.optionalCGFloatForKey("textPadding") ?? 0.0 + if let padding = dictionary.optionalCGFloatForKey("titlePadding") { + titlePadding = padding + } title.setWithJSON(dictionary.optionalDictionaryForKey("title"), delegateObject: delegateObject, additionalData: additionalData) message.setWithJSON(dictionary.optionalDictionaryForKey("message"), delegateObject: delegateObject, additionalData: additionalData) - button.setWithJSON(dictionary.optionalDictionaryForKey("button"), delegateObject: delegateObject, additionalData: additionalData) imageLoader.setWithJSON(dictionary.optionalDictionaryForKey("image"), delegateObject: delegateObject, additionalData: additionalData) + if let buttonDictionary = dictionary.optionalDictionaryForKey("button") { + button.setWithJSON(buttonDictionary, delegateObject: delegateObject, additionalData: additionalData) + button.isHidden = false + } else { + button.isHidden = true + } } } diff --git a/MVMCoreUI/Atoms/Views/ViewConstrainingView.m b/MVMCoreUI/Atoms/Views/ViewConstrainingView.m index f46916b3..dff48826 100644 --- a/MVMCoreUI/Atoms/Views/ViewConstrainingView.m +++ b/MVMCoreUI/Atoms/Views/ViewConstrainingView.m @@ -336,6 +336,7 @@ } - (void)reset { + [super reset]; self.updateViewHorizontalDefaults = NO; self.updateViewVerticalDefaults = NO; if ([self.molecule respondsToSelector:@selector(alignment)]) { From fd8b8fb7b7de43513b4934dfeea0dc51c4d11bff Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 12 Aug 2019 12:47:21 -0400 Subject: [PATCH 20/22] updates made to padding and reset/module functionality. --- .../Atoms/Views/ActionDetailWithImage.swift | 45 +++++++++++++------ 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift b/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift index 5e32bc00..e02e2278 100644 --- a/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift +++ b/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift @@ -24,7 +24,7 @@ import UIKit // MARK: - Properties //------------------------------------------------------ - var titlePadding: CGFloat = PaddingOne + var bottomTitlePadding: CGFloat = PaddingOne //------------------------------------------------------ // MARK: - Constraints @@ -64,10 +64,7 @@ import UIKit guard subviews.isEmpty else { return } - button.setAsSecondaryCustom() - button.isHidden = false - imageLoader.imageView.contentMode = .scaleAspectFit - imageLoader.addSizeConstraintsForAspectRatio = true + setDefaultState() addSubview(leftContainer) addSubview(imageLoader) @@ -121,9 +118,11 @@ import UIKit imageLoader.updateView(size) leftContainer.updateView(size) - let topPadding = title.hasText ? titlePadding : 0 - messageTopConstraint?.constant = topPadding - buttonTopConstraint?.constant = message.hasText ? PaddingTwo : topPadding + let titleMessagePadding = title.hasText ? bottomTitlePadding : 0 + let messageButtonPadding = message.hasText ? titleMessagePadding : 0 + + messageTopConstraint?.constant = messageButtonPadding + buttonTopConstraint?.constant = message.hasText ? PaddingTwo : messageButtonPadding } public override static func estimatedHeight(forRow json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { @@ -134,17 +133,38 @@ import UIKit // MARK: - Methods //------------------------------------------------------ + private func setDefaultState() { + + title.font = MFStyler.fontH3() + message.font = MFStyler.fontB3() + button.setAsSecondaryCustom() + button.isHidden = false + imageLoader.imageView.contentMode = .scaleAspectFit + imageLoader.addSizeConstraintsForAspectRatio = true + bottomTitlePadding = PaddingOne + } + override open func reset() { super.reset() - title.text = "" - message.text = "" + title.reset() + message.reset() + button.reset() imageLeadingConstraint?.constant = 16 imageLoader.reset() + + setDefaultState() } open override func setAsMolecule() { super.setAsMolecule() + + title.setAsMolecule() + message.setAsMolecule() + button.setAsMolecule() + imageLoader.setAsMolecule() + + setDefaultState() } open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { @@ -152,8 +172,8 @@ import UIKit guard let dictionary = json else { return } - if let padding = dictionary.optionalCGFloatForKey("titlePadding") { - titlePadding = padding + if let padding = dictionary.optionalCGFloatForKey("bottomTitlePadding") { + bottomTitlePadding = padding } title.setWithJSON(dictionary.optionalDictionaryForKey("title"), delegateObject: delegateObject, additionalData: additionalData) @@ -161,7 +181,6 @@ import UIKit imageLoader.setWithJSON(dictionary.optionalDictionaryForKey("image"), delegateObject: delegateObject, additionalData: additionalData) if let buttonDictionary = dictionary.optionalDictionaryForKey("button") { button.setWithJSON(buttonDictionary, delegateObject: delegateObject, additionalData: additionalData) - button.isHidden = false } else { button.isHidden = true } From 444fbc65f5b974aa63441a1979ed0658678cc3f1 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 12 Aug 2019 13:28:20 -0400 Subject: [PATCH 21/22] padding correction. --- MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift b/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift index e02e2278..e27897c5 100644 --- a/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift +++ b/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift @@ -118,11 +118,9 @@ import UIKit imageLoader.updateView(size) leftContainer.updateView(size) - let titleMessagePadding = title.hasText ? bottomTitlePadding : 0 - let messageButtonPadding = message.hasText ? titleMessagePadding : 0 - - messageTopConstraint?.constant = messageButtonPadding - buttonTopConstraint?.constant = message.hasText ? PaddingTwo : messageButtonPadding + let topPadding = title.hasText ? bottomTitlePadding : 0 + messageTopConstraint?.constant = topPadding + buttonTopConstraint?.constant = message.hasText ? PaddingTwo : topPadding } public override static func estimatedHeight(forRow json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { From 324b132051425bbf8c86416edf9ceb9a406bdc8c Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 13 Aug 2019 09:27:38 -0400 Subject: [PATCH 22/22] padding change. --- MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift b/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift index e27897c5..4792dbd6 100644 --- a/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift +++ b/MVMCoreUI/Atoms/Views/ActionDetailWithImage.swift @@ -118,9 +118,9 @@ import UIKit imageLoader.updateView(size) leftContainer.updateView(size) - let topPadding = title.hasText ? bottomTitlePadding : 0 - messageTopConstraint?.constant = topPadding - buttonTopConstraint?.constant = message.hasText ? PaddingTwo : topPadding + + messageTopConstraint?.constant = title.hasText && message.hasText ? bottomTitlePadding : 0 + buttonTopConstraint?.constant = message.hasText || title.hasText ? PaddingTwo : 0 } public override static func estimatedHeight(forRow json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {