From b3b37db8489ed06076a6860f9cbdfc5f3db8cf0a Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 9 Jan 2020 14:26:26 -0500 Subject: [PATCH 1/3] remove deprecated --- MVMCoreUI/Atoms/Views/ViewConstrainingView.m | 4 ++-- .../MVMCoreUIMoleculeMappingObject+ModelExtension.swift | 2 +- MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m | 2 +- MVMCoreUI/OtherHandlers/MVMCoreUIViewConstrainingProtocol.h | 3 --- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/ViewConstrainingView.m b/MVMCoreUI/Atoms/Views/ViewConstrainingView.m index 29f2c9be..54a12612 100644 --- a/MVMCoreUI/Atoms/Views/ViewConstrainingView.m +++ b/MVMCoreUI/Atoms/Views/ViewConstrainingView.m @@ -342,8 +342,8 @@ self.updateViewVerticalDefaults = NO; self.topMarginPadding = PaddingDefaultVerticalSpacing3; self.bottomMarginPadding = PaddingDefaultVerticalSpacing3; - if ([self.molecule respondsToSelector:@selector(alignment)]) { - [self alignHorizontal:[(UIView *)self.molecule alignment]]; + if ([self.molecule respondsToSelector:@selector(horizontalAlignment)]) { + [self alignHorizontal:[(UIView *)self.molecule horizontalAlignment]]; } [self alignVertical:UIStackViewAlignmentFill]; if ([self.molecule respondsToSelector:@selector(reset)]) { diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject+ModelExtension.swift b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject+ModelExtension.swift index 8eda8a52..45ce1bab 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject+ModelExtension.swift +++ b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject+ModelExtension.swift @@ -37,7 +37,7 @@ public extension MVMCoreUIMoleculeMappingObject { if constrainIfNeeded, let castMolecule = molecule as? MVMCoreUIViewConstrainingProtocol, castMolecule.needsToBeConstrained?() ?? false { - let view = ViewConstrainingView(molecule: molecule, alignment: castMolecule.alignment?() ?? .fill) + let view = ViewConstrainingView(molecule: molecule, alignment: castMolecule.horizontalAlignment?() ?? .fill) setData() return view } else { diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m index 3a8b7622..e32f8962 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m +++ b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m @@ -121,7 +121,7 @@ // Check if we need to constrain this view. UIView *castMolecule = [molecule conformsToProtocol:@protocol(MVMCoreUIViewConstrainingProtocol)] ? (UIView *)molecule : nil; if (constrainIfNeeded && [castMolecule respondsToSelector:@selector(needsToBeConstrained)] && [castMolecule needsToBeConstrained]) { - molecule = [[ViewConstrainingView alloc] initWithMolecule:molecule alignment:[castMolecule respondsToSelector:@selector(alignment)] ? [castMolecule alignment] : UIStackViewAlignmentFill]; + molecule = [[ViewConstrainingView alloc] initWithMolecule:molecule alignment:[castMolecule respondsToSelector:@selector(horizontalAlignment)] ? [castMolecule horizontalAlignment] : UIStackViewAlignmentFill]; } [molecule setWithJSON:json delegateObject:delegateObject additionalData:nil]; return molecule; diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUIViewConstrainingProtocol.h b/MVMCoreUI/OtherHandlers/MVMCoreUIViewConstrainingProtocol.h index a2ac2340..12aaacdb 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUIViewConstrainingProtocol.h +++ b/MVMCoreUI/OtherHandlers/MVMCoreUIViewConstrainingProtocol.h @@ -15,9 +15,6 @@ /// Notifies the creator that the view may not be suitable to be shown on its own and it needs to be added to a view to help with layout. - (BOOL)needsToBeConstrained; -/// The alignment if constrained. -- (UIStackViewAlignment)alignment __deprecated; - /// The alignment if constrained. - (UIStackViewAlignment)horizontalAlignment; From 40def6e19b22706962f0e52b80290d483f9766c0 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 9 Jan 2020 14:30:25 -0500 Subject: [PATCH 2/3] control default --- MVMCoreUI/BaseClasses/Control.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MVMCoreUI/BaseClasses/Control.swift b/MVMCoreUI/BaseClasses/Control.swift index e425a29b..a633f4e1 100644 --- a/MVMCoreUI/BaseClasses/Control.swift +++ b/MVMCoreUI/BaseClasses/Control.swift @@ -51,6 +51,9 @@ import UIKit public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) { self.model = model + if let backgroundColor = model?.backgroundColor { + self.backgroundColor = backgroundColor.uiColor + } } //-------------------------------------------------- From 0e6a2202ea0afe79300d8a5d68acbafb762bc4b7 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 9 Jan 2020 15:51:42 -0500 Subject: [PATCH 3/3] Remove old file --- .../ContainerMoleculeProtocol.swift | 40 ------------------- 1 file changed, 40 deletions(-) delete mode 100644 MVMCoreUI/Models/ModelProtocols/ContainerMoleculeProtocol.swift diff --git a/MVMCoreUI/Models/ModelProtocols/ContainerMoleculeProtocol.swift b/MVMCoreUI/Models/ModelProtocols/ContainerMoleculeProtocol.swift deleted file mode 100644 index 9a303bdf..00000000 --- a/MVMCoreUI/Models/ModelProtocols/ContainerMoleculeProtocol.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// ContainerMoleculeProtocol.swift -// MVMCoreUI -// -// Created by Suresh, Kamlesh on 12/4/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -import Foundation - -public protocol ContainerMoleculeProtocol: MoleculeProtocol { - var molecule: MoleculeProtocol { get } - var useHorizontalMargins: Bool? { get } - var useVerticalMargins: Bool? { get } - var horizontalAlignment: String? { get } - var verticalAlignment: String? { get } -} - -extension ContainerMoleculeProtocol { - public var backgroundColor: Color? { - get { return nil } - } - - public var useHorizontalMargins: Bool? { - get { return nil } - } - - public var useVerticalMargins: Bool? { - get { return nil } - } - - public var horizontalAlignment: String? { - get { return nil } - } - - public var verticalAlignment: String? { - get { return nil } - } -} -