diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 56e3492c..a6588ea8 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 48; + objectVersion = 52; objects = { /* Begin PBXBuildFile section */ @@ -273,6 +273,7 @@ AAE96FA225341F6A0037A989 /* ListStoreLocatorModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAE96FA125341F6A0037A989 /* ListStoreLocatorModel.swift */; }; AAE96FA525341F7D0037A989 /* ListStoreLocator.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAE96FA425341F7D0037A989 /* ListStoreLocator.swift */; }; AFE4A1D627DFBB6F00C458D0 /* UINavigationController+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFE4A1D527DFBB6F00C458D0 /* UINavigationController+Extension.swift */; }; + AFE4A1D127DFB5EE00C458D0 /* VDSColorTokens.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = AFE4A1D027DFB5EE00C458D0 /* VDSColorTokens.xcframework */; }; BB105859248DEFF70069D008 /* UICollectionViewLeftAlignedLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB105858248DEFF60069D008 /* UICollectionViewLeftAlignedLayout.swift */; }; BB1D17E0244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */; }; BB1D17E2244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1D17E1244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift */; }; @@ -859,6 +860,7 @@ AAE96FA125341F6A0037A989 /* ListStoreLocatorModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListStoreLocatorModel.swift; sourceTree = ""; }; AAE96FA425341F7D0037A989 /* ListStoreLocator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListStoreLocator.swift; sourceTree = ""; }; AFE4A1D527DFBB6F00C458D0 /* UINavigationController+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UINavigationController+Extension.swift"; sourceTree = ""; }; + AFE4A1D027DFB5EE00C458D0 /* VDSColorTokens.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = VDSColorTokens.xcframework; path = ../SharedFrameworks/VDSColorTokens.xcframework; sourceTree = ""; }; BB105858248DEFF60069D008 /* UICollectionViewLeftAlignedLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UICollectionViewLeftAlignedLayout.swift; sourceTree = ""; }; BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonMediumModel.swift; sourceTree = ""; }; BB1D17E1244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonMedium.swift; sourceTree = ""; }; @@ -1183,6 +1185,7 @@ buildActionMask = 2147483647; files = ( D29DF0E621E4F3C7003B2FB9 /* MVMCore.framework in Frameworks */, + AFE4A1D127DFB5EE00C458D0 /* VDSColorTokens.xcframework in Frameworks */, 9455B19C234F8A0400A574DB /* MVMAnimationFramework.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -2013,6 +2016,7 @@ D29DF0E421E4F3C7003B2FB9 /* Frameworks */ = { isa = PBXGroup; children = ( + AFE4A1D027DFB5EE00C458D0 /* VDSColorTokens.xcframework */, D29DF0E521E4F3C7003B2FB9 /* MVMCore.framework */, 9455B19B234F8A0400A574DB /* MVMAnimationFramework.framework */, ); @@ -3280,7 +3284,8 @@ MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -3303,7 +3308,11 @@ INFOPLIST_FILE = MVMCoreUI/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); MARKETING_VERSION = 2.0; PRODUCT_BUNDLE_IDENTIFIER = com.vzw.MVMCoreUI; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; @@ -3330,7 +3339,11 @@ INFOPLIST_FILE = MVMCoreUI/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); MARKETING_VERSION = 2.0; PRODUCT_BUNDLE_IDENTIFIER = com.vzw.MVMCoreUI; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; diff --git a/MVMCoreUI/Atomic/Atoms/Views/LineModel.swift b/MVMCoreUI/Atomic/Atoms/Views/LineModel.swift index a3073f52..f463c0f9 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LineModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LineModel.swift @@ -7,7 +7,7 @@ // import UIKit - +import VDSColorTokens @objcMembers public class LineModel: MoleculeModelProtocol { //-------------------------------------------------- @@ -57,10 +57,13 @@ import UIKit private var _backgroundColor: Color? public var backgroundColor: Color? { get { - if inverted { return backgroundColor_inverted } if let backgroundColor = _backgroundColor { return backgroundColor } - if type == .standard { return Color(uiColor: .mvmCoolGray3) } - return Color(uiColor: .mvmBlack) + if inverted { + if type == .standard { return Color(uiColor: VDSColor.interactiveDisabledOndark) } + return Color(uiColor: VDSColor.elementsPrimaryOndark) + } + if type == .standard { return Color(uiColor: VDSColor.interactiveDisabledOnlight) } + return Color(uiColor: VDSColor.elementsPrimaryOnlight) } set { _backgroundColor = newValue @@ -87,7 +90,6 @@ import UIKit } } - public var backgroundColor_inverted: Color = Color(uiColor: .mvmWhite) public var inverted: Bool = false // Use this to show vertical line @@ -144,10 +146,6 @@ import UIKit self.inverted = inverted } - if let backgroundColor_inverted = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor_inverted) { - self.backgroundColor_inverted = backgroundColor_inverted - } - backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) useVerticalLine = try typeContainer.decodeIfPresent(Bool.self, forKey: .useVerticalLine) _thickness = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .thickness) @@ -160,7 +158,6 @@ import UIKit try container.encode(inverted, forKey: .inverted) try container.encodeIfPresent(frequency, forKey: .frequency) try container.encodeIfPresent(_backgroundColor, forKey: .backgroundColor) - try container.encodeIfPresent(backgroundColor_inverted, forKey: .backgroundColor_inverted) try container.encodeIfPresent(useVerticalLine, forKey: .useVerticalLine) try container.encodeIfPresent(_thickness, forKey: .thickness) } diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift index c4df44c0..dbea90d7 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift @@ -5,7 +5,7 @@ // Created by Scott Pfeil on 5/28/20. // Copyright © 2020 Verizon Wireless. All rights reserved. // - +import VDSColorTokens @objcMembers open class TabBar: UITabBar, MoleculeViewProtocol, TabBarProtocol, UITabBarDelegate { @@ -21,7 +21,6 @@ delegate = self translatesAutoresizingMaskIntoConstraints = false line.addLine(to: self, edge: .top, useMargin: false) - line.backgroundColor = .mvmCoolGray3 set(with: model, delegateObject, additionalData) } @@ -50,6 +49,10 @@ } setItems(tabs, animated: false) selectedItem = tabs[model.selectedTab] + + guard let lineModel = line.lineModel else { return } + lineModel.inverted = model.style == .dark + line.set(with: lineModel, delegateObject, additionalData) } /// Sets the item colors. diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift index 2a55b31e..95e07a34 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift @@ -7,6 +7,7 @@ // import Foundation +import VDSColorTokens open class TabBarModel: MoleculeModelProtocol { public static var identifier: String = "tabBar" @@ -17,8 +18,8 @@ open class TabBarModel: MoleculeModelProtocol { get { if let backgroundColor = _backgroundColor { return backgroundColor } if let style = style, - style == .dark { return Color(uiColor: .mvmBlack) } - return Color(uiColor: .mvmWhite) + style == .dark { return Color(uiColor: VDSColor.backgroundPrimaryDark) } + return Color(uiColor: VDSColor.backgroundPrimaryLight) } set { _backgroundColor = newValue @@ -30,8 +31,8 @@ open class TabBarModel: MoleculeModelProtocol { get { if let selectedColor = _selectedColor { return selectedColor } if let style = style, - style == .dark { return Color(uiColor: .mvmWhite) } - return Color(uiColor: .mvmBlack) + style == .dark { return Color(uiColor: VDSColor.elementsPrimaryOndark) } + return Color(uiColor: VDSColor.elementsPrimaryOnlight) } set { _selectedColor = newValue @@ -41,8 +42,10 @@ open class TabBarModel: MoleculeModelProtocol { private var _unSelectedColor: Color? open var unSelectedColor: Color { get { - if let unselectedColor = _unSelectedColor { return unselectedColor } - return Color(uiColor: .mvmCoolGray6) + if let unSelectedColor = _unSelectedColor { return unSelectedColor } + if let style = style, + style == .dark { return Color(uiColor: VDSColor.elementsSecondaryOndark) } + return Color(uiColor: VDSColor.elementsSecondaryOnlight) } set { _unSelectedColor = newValue diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift index 7fdbc9b1..4e424549 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift @@ -7,6 +7,7 @@ // import UIKit +import VDSColorTokens @objc public protocol TabsDelegate { func shouldSelectItem(_ indexPath: IndexPath, tabs: Tabs) -> Bool @@ -66,7 +67,7 @@ import UIKit open override func setupView() { super.setupView() - backgroundColor = .white + backgroundColor = VDSColor.backgroundPrimaryLight addSubview(bottomLine) setupCollectionView() setupSelectionLine() @@ -94,7 +95,7 @@ import UIKit bottomScrollView.delegate = self addSubview(bottomScrollView) bottomScrollView.addSubview(bottomContentView) - selectionLine.backgroundColor = .mvmRed + selectionLine.backgroundColor = VDSColor.paletteRed bottomContentView.addSubview(selectionLine) bringSubviewToFront(bottomScrollView) } @@ -168,10 +169,10 @@ extension Tabs: UICollectionViewDataSource { } public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - guard let labelModel = tabsModel?.tabs[indexPath.row].label, let cell = collectionView.dequeueReusableCell(withReuseIdentifier: TabCellId, for: indexPath) as? TabItemCell else { + guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: TabCellId, for: indexPath) as? TabItemCell else { return UICollectionViewCell() } - cell.updateCell(labelModel: labelModel, indexPath: indexPath, delegateObject: delegateObject, additionalData: additionalData, selected: indexPath.row == selectedIndex, tabsModel: tabsModel) + cell.updateCell(indexPath: indexPath, delegateObject: delegateObject, additionalData: additionalData, selected: indexPath.row == selectedIndex, tabsModel: tabsModel) updateView(collectionView.bounds.width) return cell } @@ -331,13 +332,14 @@ extension Tabs { label.updateView(size) } - public func updateCell(labelModel: LabelModel, indexPath: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?, selected: Bool, tabsModel: TabsModel?) { + public func updateCell(indexPath: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?, selected: Bool, tabsModel: TabsModel?) { + guard let tabsModel = tabsModel else { return } label.reset() - label.set(with: labelModel, delegateObject, additionalData) + label.set(with: tabsModel.tabs[indexPath.row].label, delegateObject, additionalData) if selected { - label.textColor = tabsModel?.selectedColor.uiColor ?? .black + label.textColor = tabsModel.selectedColor.uiColor } else { - label.textColor = tabsModel?.unselectedColor.uiColor ?? .mvmCoolGray6 + label.textColor = tabsModel.unselectedColor.uiColor } updateAccessibility(indexPath: indexPath, selected: selected, tabsModel: tabsModel) } diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift index 16897c67..6e154895 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift @@ -7,6 +7,7 @@ // import UIKit +import VDSColorTokens open class TabsModel: MoleculeModelProtocol { public static var identifier: String = "tabs" @@ -19,8 +20,8 @@ open class TabsModel: MoleculeModelProtocol { get { if let backgroundColor = _backgroundColor { return backgroundColor } if let style = style, - style == .dark { return Color(uiColor: .mvmBlack) } - return Color(uiColor: .mvmWhite) + style == .dark { return Color(uiColor: VDSColor.backgroundPrimaryDark) } + return Color(uiColor: VDSColor.backgroundPrimaryLight) } set { _backgroundColor = newValue @@ -32,8 +33,8 @@ open class TabsModel: MoleculeModelProtocol { get { if let selectedColor = _selectedColor { return selectedColor } if let style = style, - style == .dark { return Color(uiColor: .mvmWhite) } - return Color(uiColor: .mvmBlack) + style == .dark { return Color(uiColor: VDSColor.elementsPrimaryOndark) } + return Color(uiColor: VDSColor.elementsPrimaryOnlight) } set { _selectedColor = newValue @@ -44,7 +45,9 @@ open class TabsModel: MoleculeModelProtocol { open var unselectedColor: Color { get { if let unselectedColor = _unselectedColor { return unselectedColor } - return Color(uiColor: .mvmCoolGray6) + if let style = style, + style == .dark { return Color(uiColor: VDSColor.elementsSecondaryOndark) } + return Color(uiColor: VDSColor.elementsSecondaryOnlight) } set { _unselectedColor = newValue @@ -56,8 +59,8 @@ open class TabsModel: MoleculeModelProtocol { get { if let selectedBarColor = _selectedBarColor { return selectedBarColor } if let style = style, - style == .dark { return Color(uiColor: .mvmWhite) } - return Color(uiColor: .mvmRed) + style == .dark { return Color(uiColor: VDSColor.elementsPrimaryOndark) } + return Color(uiColor: VDSColor.paletteRed) } set { _selectedBarColor = newValue diff --git a/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift b/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift index 574107d6..c2e1ccc6 100644 --- a/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift @@ -6,6 +6,8 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // +import VDSColorTokens + public enum NavigationItemStyle: String, Codable { case light case dark @@ -31,8 +33,8 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc get { if let backgroundColor = _backgroundColor { return backgroundColor } if let style = style, - style == .dark { return Color(uiColor: .mvmBlack) } - return Color(uiColor: .mvmWhite) + style == .dark { return Color(uiColor: VDSColor.backgroundPrimaryDark) } + return Color(uiColor: VDSColor.backgroundPrimaryLight) } set { _backgroundColor = newValue @@ -44,8 +46,8 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc get { if let tintColor = _tintColor { return tintColor } if let style = style, - style == .dark { return Color(uiColor: .mvmWhite) } - return Color(uiColor: .mvmBlack) + style == .dark { return Color(uiColor: VDSColor.elementsPrimaryOndark) } + return Color(uiColor: VDSColor.elementsPrimaryOnlight) } set { _tintColor = newValue @@ -113,6 +115,7 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc titleView = try typeContainer.decodeModelIfPresent(codingKey: .titleView) style = try typeContainer.decodeIfPresent(NavigationItemStyle.self, forKey: .style) titleOffset = try typeContainer.decodeIfPresent(UIOffset.self, forKey: .titleOffset) ?? UIOffset(horizontal: -CGFloat.greatestFiniteMagnitude, vertical: 0) + line?.inverted = style == .dark } open func encode(to encoder: Encoder) throws { diff --git a/MVMCoreUI/Styles/Styler.swift b/MVMCoreUI/Styles/Styler.swift index 77402295..4da119fc 100644 --- a/MVMCoreUI/Styles/Styler.swift +++ b/MVMCoreUI/Styles/Styler.swift @@ -156,10 +156,10 @@ open class Styler { } } else { if isBold() { - return size >= 15 ? MFFonts.mfFontDSBold(size) : MFFonts.mfFontTXBold(size) + return size >= 13 ? MFFonts.mfFontDSBold(size) : MFFonts.mfFontTXBold(size) } else { - return size >= 15 ? MFFonts.mfFontDSRegular(size) : MFFonts.mfFontTXRegular(size) + return size >= 13 ? MFFonts.mfFontDSRegular(size) : MFFonts.mfFontTXRegular(size) } } }