From c81f68d66dacbdedffc5ba5e3af6beaa73dda0d0 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 3 Feb 2020 08:54:41 -0500 Subject: [PATCH 1/4] adding color and removing pointless loop. --- MVMCoreUI/Categories/UIColor+Extension.swift | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/MVMCoreUI/Categories/UIColor+Extension.swift b/MVMCoreUI/Categories/UIColor+Extension.swift index fab1ae6f..aec1ce17 100644 --- a/MVMCoreUI/Categories/UIColor+Extension.swift +++ b/MVMCoreUI/Categories/UIColor+Extension.swift @@ -25,6 +25,7 @@ extension UIColor { "coolGray1": (.mvmCoolGray1, "#F6F6F6"), "coolGray3": (.mvmCoolGray3, "#D8DADA"), "coolGray6": (.mvmCoolGray6, "#747676"), + "coolGray10": (.mvmCoolGray10, "#333333"), "vzupGold": (.vzupGold, "#B89B56"), "vzupYellow1": (.vzupYellow1, "#F9D542"), "vzupYellow2": (.vzupYellow2, "#F4CA53"), @@ -67,6 +68,9 @@ extension UIColor { /// HEX: #747676 public static let mvmCoolGray6 = UIColor.color8Bits(red: 116, green: 118, blue: 118) + /// HEX: #333333 + public static let mvmCoolGray10 = UIColor.grayscale(rgb: 51) + //-------------------------------------------------- // MARK: - VZ UP Brand //-------------------------------------------------- @@ -199,12 +203,6 @@ extension UIColor { public class func getColorAndHexFromName(_ name: String) -> ColorHexTuple? { - for row in names { - if name == row.key { - return row.value - } - } - - return nil + return names[name] } } From be2e9473b3f2b6a7a53cb1539e68135a48267213 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 3 Feb 2020 09:00:03 -0500 Subject: [PATCH 2/4] Removing func as the static dictionary can carry the weight. --- MVMCoreUI/Categories/UIColor+Extension.swift | 7 +------ MVMCoreUI/CustomPrimitives/Color.swift | 4 ++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/MVMCoreUI/Categories/UIColor+Extension.swift b/MVMCoreUI/Categories/UIColor+Extension.swift index aec1ce17..55a10c03 100644 --- a/MVMCoreUI/Categories/UIColor+Extension.swift +++ b/MVMCoreUI/Categories/UIColor+Extension.swift @@ -6,11 +6,11 @@ // Copyright © 2019 Verizon Wireless. All rights reserved. // - import UIKit public typealias ColorHexTuple = (uiColor: UIColor, hex: String) + extension UIColor { /// Dictionary to access brand approved colors by name. @@ -200,9 +200,4 @@ extension UIColor { return nil } - - public class func getColorAndHexFromName(_ name: String) -> ColorHexTuple? { - - return names[name] - } } diff --git a/MVMCoreUI/CustomPrimitives/Color.swift b/MVMCoreUI/CustomPrimitives/Color.swift index d72e1af9..a34fbd45 100644 --- a/MVMCoreUI/CustomPrimitives/Color.swift +++ b/MVMCoreUI/CustomPrimitives/Color.swift @@ -56,7 +56,7 @@ public final class Color: Codable { } init?(name: String) { - guard let colorTuple = UIColor.getColorAndHexFromName(name) else { return nil } + guard let colorTuple = UIColor.names[name] else { return nil } self.uiColor = colorTuple.uiColor self.hex = colorTuple.hex determineRGBA() @@ -73,7 +73,7 @@ public final class Color: Codable { if colorString.hasPrefix("#") { hex = colorString.replacingOccurrences(of: "#", with: "") } else { - guard let hex = UIColor.getColorAndHexFromName(colorString)?.hex else { throw ColorError.badName(reason: "Check the spelling of your color.") } + guard let hex = UIColor.names[colorString]?.hex else { throw ColorError.badName(reason: "Check the spelling of your color.") } self.hex = hex.replacingOccurrences(of: "#", with: "") name = colorString } From 9110c842a54db82edd949ad5675b82e73b6d8c52 Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Mon, 3 Feb 2020 09:42:11 -0500 Subject: [PATCH 3/4] fix typo --- .../Molecules/HorizontalCombinationViews/PrimaryButtonView.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Molecules/HorizontalCombinationViews/PrimaryButtonView.m b/MVMCoreUI/Molecules/HorizontalCombinationViews/PrimaryButtonView.m index 1bcc6a9e..8c76353c 100644 --- a/MVMCoreUI/Molecules/HorizontalCombinationViews/PrimaryButtonView.m +++ b/MVMCoreUI/Molecules/HorizontalCombinationViews/PrimaryButtonView.m @@ -370,7 +370,7 @@ return [self initWithPrimaryButtonMap:primaryButtonMap secondaryButtonMap:secondaryButtonMap actionDelegate:actionDelegate additionalData:additionalData buttonDelegate:buttonDelegate]; } -- (void)setupWithButtonMap:(nullable NSDictionary *)buttonMap delegate:(nullable DelegateObject *)delegateObject additionalData:(nullable NSDictionary *)additionalData { +- (void)setupWithButtonMap:(nullable NSDictionary *)buttonMap delegateObject:(nullable DelegateObject *)delegateObject additionalData:(nullable NSDictionary *)additionalData { NSObject *buttonDelegate = nil; NSObject *actionDelegate = delegateObject.actionDelegate; if ([delegateObject isKindOfClass:[MVMCoreUIDelegateObject class]]) { From c83302ec089b1a835ccbd67eceea3cb77c8d4f3a Mon Sep 17 00:00:00 2001 From: "Chintakrinda, Arun Kumar (Arun)" Date: Tue, 4 Feb 2020 14:37:31 +0530 Subject: [PATCH 4/4] Stack model bug fix from molecueStack to stack --- MVMCoreUI/Templates/StackPageTemplateModel.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Templates/StackPageTemplateModel.swift b/MVMCoreUI/Templates/StackPageTemplateModel.swift index b9a54125..10a2cf6f 100644 --- a/MVMCoreUI/Templates/StackPageTemplateModel.swift +++ b/MVMCoreUI/Templates/StackPageTemplateModel.swift @@ -30,14 +30,14 @@ import Foundation case screenHeading case header case footer - case moleculeStack + case stack case isAtomicTabs } required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) pageType = try typeContainer.decode(String.self, forKey: .pageType) - moleculeStack = try typeContainer.decode(MoleculeStackModel.self, forKey: .moleculeStack) + moleculeStack = try typeContainer.decode(MoleculeStackModel.self, forKey: .stack) screenHeading = try typeContainer.decodeIfPresent(String.self, forKey: .screenHeading) isAtomicTabs = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAtomicTabs) header = try typeContainer.decodeMoleculeIfPresent(codingKey: .header) @@ -47,7 +47,7 @@ import Foundation public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(pageType, forKey: .pageType) - try container.encode(moleculeStack, forKey: .moleculeStack) + try container.encode(moleculeStack, forKey: .stack) try container.encodeIfPresent(screenHeading, forKey: .screenHeading) try container.encodeIfPresent(isAtomicTabs, forKey: .isAtomicTabs) try container.encodeModelIfPresent(header, forKey: .header)