From 0dae2d36cb5da8ee856d9922c6e06b1f22e54a16 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 8 Sep 2023 15:46:34 -0500 Subject: [PATCH 1/7] fixed bug in app when swapping back and forth between sizes Signed-off-by: Matt Bruce --- VDS/Components/Tabs/Tab.swift | 5 ++--- VDS/Components/Tabs/Tabs.swift | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/VDS/Components/Tabs/Tab.swift b/VDS/Components/Tabs/Tab.swift index 079b01d5..9129b65c 100644 --- a/VDS/Components/Tabs/Tab.swift +++ b/VDS/Components/Tabs/Tab.swift @@ -162,15 +162,14 @@ extension Tabs { labelBottomConstraint?.constant = -otherSpace //label properties + label.textStyle = textStyle label.text = text label.surface = surface - label.textStyle = textStyle label.textAlignment = textAlignment.value label.textColorConfiguration = textColorConfiguration.eraseToAnyColorable() setNeedsLayout() layoutIfNeeded() - - } + } /// Used to update any Accessibility properties. open override func updateAccessibility() { diff --git a/VDS/Components/Tabs/Tabs.swift b/VDS/Components/Tabs/Tabs.swift index dc73bc62..d742db56 100644 --- a/VDS/Components/Tabs/Tabs.swift +++ b/VDS/Components/Tabs/Tabs.swift @@ -111,7 +111,7 @@ open class Tabs: View { open var selectedIndex: Int = 0 { didSet { setNeedsUpdate() } } /// Determines the size of the Tabs TextStyle - open var size: Size = .medium { didSet { setNeedsUpdate() } } + open var size: Size = .medium { didSet { updateTabItems() } } /// When true, Tabs will be sticky to top of page, when orientation is vertical. open var sticky: Bool = false { didSet { setNeedsUpdate() } } From ce8e2fb535a9acb9e447c5f0c3ea948b324b44af Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 12 Sep 2023 12:17:04 -0500 Subject: [PATCH 2/7] added number of lines Signed-off-by: Matt Bruce --- VDS/Components/Tabs/Tab.swift | 3 +++ VDS/Components/Tabs/Tabs.swift | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/VDS/Components/Tabs/Tab.swift b/VDS/Components/Tabs/Tab.swift index 9129b65c..0c061224 100644 --- a/VDS/Components/Tabs/Tab.swift +++ b/VDS/Components/Tabs/Tab.swift @@ -68,6 +68,9 @@ extension Tabs { ///Size for tab open var size: Tabs.Size = .medium { didSet { setNeedsUpdate() } } + ///Number of lines in the Label. + open var numberOfLines: Int = 0 { didSet { setNeedsUpdate() } } + ///Text position left or center open var textAlignment: TextAlignment = .left { didSet { setNeedsUpdate() } } diff --git a/VDS/Components/Tabs/Tabs.swift b/VDS/Components/Tabs/Tabs.swift index d742db56..75171806 100644 --- a/VDS/Components/Tabs/Tabs.swift +++ b/VDS/Components/Tabs/Tabs.swift @@ -111,7 +111,7 @@ open class Tabs: View { open var selectedIndex: Int = 0 { didSet { setNeedsUpdate() } } /// Determines the size of the Tabs TextStyle - open var size: Size = .medium { didSet { updateTabItems() } } + open var size: Size = .large { didSet { setNeedsUpdate() } } /// When true, Tabs will be sticky to top of page, when orientation is vertical. open var sticky: Bool = false { didSet { setNeedsUpdate() } } @@ -269,7 +269,7 @@ open class Tabs: View { private func updateTabs() { let numberOfLines = applyOverflow ? 1 : 0 for (index, tabItem) in tabViews.enumerated() { - tabItem.label.numberOfLines = numberOfLines + tabItem.numberOfLines = numberOfLines tabItem.size = size tabItem.isSelected = selectedIndex == index tabItem.index = index From e52ae195f3db4cfc5c2f7998303547e171ec74a7 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 12 Sep 2023 14:04:05 -0500 Subject: [PATCH 3/7] fix for setting text issue Signed-off-by: Matt Bruce --- VDS/Components/Label/Label.swift | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/VDS/Components/Label/Label.swift b/VDS/Components/Label/Label.swift index d242c2e6..76dceb19 100644 --- a/VDS/Components/Label/Label.swift +++ b/VDS/Components/Label/Label.swift @@ -129,12 +129,18 @@ open class Label: UILabel, ViewProtocol, UserInfoable { /// Line break mode for the label, default is set to word wrapping. open override var lineBreakMode: NSLineBreakMode { didSet { setNeedsUpdate() }} + private var _text: String? + /// Text that will be used in the label. override open var text: String? { - didSet { - useAttributedText = false - attributes = nil - setNeedsUpdate() + get { _text } + set { + if _text != newValue { + _text = newValue + useAttributedText = false + attributes = nil + setNeedsUpdate() + } } } @@ -194,7 +200,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable { open func updateView() { if !useAttributedText { - if let text = text { + if let text { accessibilityCustomActions = [] //create the primary string From 61ebc59e3ff8d305b4f133e820f153917e42fd10 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 12 Sep 2023 16:07:02 -0500 Subject: [PATCH 4/7] CXTDT-462698 - Tabs - Incorrect letter spacing on Large tabs Signed-off-by: Matt Bruce --- VDS/Components/Tabs/Tabs.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VDS/Components/Tabs/Tabs.swift b/VDS/Components/Tabs/Tabs.swift index 75171806..0fc447cd 100644 --- a/VDS/Components/Tabs/Tabs.swift +++ b/VDS/Components/Tabs/Tabs.swift @@ -111,7 +111,7 @@ open class Tabs: View { open var selectedIndex: Int = 0 { didSet { setNeedsUpdate() } } /// Determines the size of the Tabs TextStyle - open var size: Size = .large { didSet { setNeedsUpdate() } } + open var size: Size = .medium { didSet { setNeedsUpdate() } } /// When true, Tabs will be sticky to top of page, when orientation is vertical. open var sticky: Bool = false { didSet { setNeedsUpdate() } } From 6039836dda79602ebd33c5decf7ccf0210bea112 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 12 Sep 2023 16:07:14 -0500 Subject: [PATCH 5/7] Signed-off-by: Matt Bruce --- VDS/SupportingFiles/ReleaseNotes.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index be7fa5cd..bbdeb8ee 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -1,3 +1,7 @@ +1.0.42 +======= +- CXTDT-462698 - Tabs - Incorrect letter spacing on Large tabs + 1.0.41 ======= - CXTDT-457899 - Tabs - Incorrect non-selected color on Dark surface From 4adb378ce50d52bca5cef28d77f165f8517e735b Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 12 Sep 2023 16:33:40 -0500 Subject: [PATCH 6/7] CXTDT-427328 - Title Lockup text style combinations do not match spec Signed-off-by: Matt Bruce --- VDS/Components/TitleLockup/TitleLockup.swift | 98 ++++++++++---------- VDS/SupportingFiles/ReleaseNotes.txt | 1 + 2 files changed, 50 insertions(+), 49 deletions(-) diff --git a/VDS/Components/TitleLockup/TitleLockup.swift b/VDS/Components/TitleLockup/TitleLockup.swift index 2fdd5598..41a6cb70 100644 --- a/VDS/Components/TitleLockup/TitleLockup.swift +++ b/VDS/Components/TitleLockup/TitleLockup.swift @@ -29,7 +29,7 @@ open class TitleLockup: View { public required init?(coder: NSCoder) { super.init(coder: coder) } - + //-------------------------------------------------- // MARK: - Enums //-------------------------------------------------- @@ -43,12 +43,6 @@ open class TitleLockup: View { //-------------------------------------------------- // MARK: - Private Properties //-------------------------------------------------- - private var stackView = UIStackView().with { - $0.translatesAutoresizingMaskIntoConstraints = false - $0.axis = .vertical - $0.distribution = .fillProportionally - } - private var otherStandardStyle: OtherStandardStyle { if let subTitleModel, !subTitleModel.text.isEmpty { return subTitleModel.standardStyle @@ -75,7 +69,7 @@ open class TitleLockup: View { open var eyebrowLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) } - + /// Model used in rendering the eyebrow label. open var eyebrowModel: EyebrowModel? { didSet { setNeedsUpdate() } } @@ -84,7 +78,7 @@ open class TitleLockup: View { open var titleLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) } - + /// Model used in rendering the title label. open var titleModel: TitleModel? { didSet { setNeedsUpdate() } } @@ -93,7 +87,7 @@ open class TitleLockup: View { open var subTitleLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) } - + /// Model used in rendering the subtitle label. open var subTitleModel: SubTitleModel? { didSet { setNeedsUpdate() } } @@ -273,22 +267,8 @@ open class TitleLockup: View { super.setup() titleLabel.textColorConfiguration = textColorPrimaryConfiguration - + accessibilityElements = [eyebrowLabel, titleLabel, subTitleLabel] - addSubview(stackView) - - stackView.spacing = 0.0 - - stackView.addArrangedSubview(eyebrowLabel) - stackView.addArrangedSubview(titleLabel) - stackView.addArrangedSubview(subTitleLabel) - - //pin stackview to edges - stackView - .pinTop() - .pinLeading() - .pinTrailing() - .pinBottom(0, .defaultHigh) } /// Resets to default settings. @@ -302,15 +282,18 @@ open class TitleLockup: View { setNeedsUpdate() } + var labelViews = [UIView]() /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() - let allLabelsTextAlignment = textAlignment.value.value - var eyebrowTextIsEmpty = true - var titleTextIsEmpty = true - var subTitleTextIsEmpty = true + //remove all labels + eyebrowLabel.removeFromSuperview() + titleLabel.removeFromSuperview() + subTitleLabel.removeFromSuperview() + //set local vars + let allLabelsTextAlignment = textAlignment.value.value var topSpacing: CGFloat = 0.0 var bottomSpacing: CGFloat = 0.0 @@ -321,8 +304,12 @@ open class TitleLockup: View { bottomSpacing = config.bottomSpacing } + //set a previousView to keep track of the stack + //to deal with anchoring/spacing + var previousView: UIView? + + //see if the eyebrow should exist if let eyebrowModel, !eyebrowModel.text.isEmpty { - eyebrowTextIsEmpty = false eyebrowLabel.textAlignment = allLabelsTextAlignment eyebrowLabel.text = eyebrowModel.text eyebrowLabel.attributes = eyebrowModel.textAttributes @@ -345,20 +332,35 @@ open class TitleLockup: View { eyebrowLabel.textColorConfiguration = textColorPrimaryConfiguration eyebrowLabel.textStyle = eyebrowModel.isBold ? otherStandardStyle.value.bold : otherStandardStyle.value.regular } + addSubview(eyebrowLabel) + eyebrowLabel + .pinTop() + .pinLeading() + .pinTrailing() + + previousView = eyebrowLabel } + //see if the title should exist if let titleModel, !titleModel.text.isEmpty { - titleTextIsEmpty = false titleLabel.textAlignment = allLabelsTextAlignment titleLabel.textStyle = titleModel.textStyle titleLabel.text = titleModel.text titleLabel.attributes = titleModel.textAttributes titleLabel.numberOfLines = titleModel.numberOfLines titleLabel.surface = surface + + addSubview(titleLabel) + titleLabel + .pinTop(previousView?.bottomAnchor ?? self.topAnchor, eyebrowLabel == previousView ? topSpacing : 0) + .pinLeading() + .pinTrailing() + + previousView = titleLabel } + //see if the subtitle should exist if let subTitleModel, !subTitleModel.text.isEmpty { - subTitleTextIsEmpty = false subTitleLabel.textAlignment = allLabelsTextAlignment subTitleLabel.textStyle = otherStandardStyle.value.regular subTitleLabel.textColorConfiguration = subTitleModel.textColor == .secondary ? textColorSecondaryConfiguration : textColorPrimaryConfiguration @@ -366,25 +368,23 @@ open class TitleLockup: View { subTitleLabel.attributes = subTitleModel.textAttributes subTitleLabel.numberOfLines = subTitleModel.numberOfLines subTitleLabel.surface = surface + + addSubview(subTitleLabel) + subTitleLabel + .pinTop(previousView?.bottomAnchor ?? self.topAnchor, (eyebrowLabel == previousView || titleLabel == previousView) ? bottomSpacing : 0) + .pinLeading() + .pinTrailing() + + previousView = subTitleLabel } - //if both first 2 rows not empty set spacing - if !eyebrowTextIsEmpty && !titleTextIsEmpty { - stackView.spacing = topSpacing - } else { - stackView.spacing = 0.0 - } + //pin the last view to the bottom of this view + previousView?.pinBottom() - //if either first 2 rows not empty and subtile not empty, create space else collapse - if (!eyebrowTextIsEmpty || !titleTextIsEmpty) && !subTitleTextIsEmpty { - stackView.setCustomSpacing(bottomSpacing, after: titleLabel) - } else if (!eyebrowTextIsEmpty || !titleTextIsEmpty) && subTitleTextIsEmpty { - stackView.setCustomSpacing(0.0, after: titleLabel) - } - - //hide/show - eyebrowLabel.isHidden = eyebrowTextIsEmpty - titleLabel.isHidden = titleTextIsEmpty - subTitleLabel.isHidden = subTitleTextIsEmpty + //debugging for borders + eyebrowLabel.debugBorder(show: hasDebugBorder, color: .green) + titleLabel.debugBorder(show: hasDebugBorder, color: .green) + subTitleLabel .debugBorder(show: hasDebugBorder, color: .green) } + } diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index bbdeb8ee..6dae1502 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -1,6 +1,7 @@ 1.0.42 ======= - CXTDT-462698 - Tabs - Incorrect letter spacing on Large tabs +- CXTDT-427328 - Title Lockup text style combinations do not match spec 1.0.41 ======= From 184d450c05e62b8aac23298bf8088d3095986894 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 12 Sep 2023 16:34:03 -0500 Subject: [PATCH 7/7] updated version 42 Signed-off-by: Matt Bruce --- VDS.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VDS.xcodeproj/project.pbxproj b/VDS.xcodeproj/project.pbxproj index be43c783..4661e23d 100644 --- a/VDS.xcodeproj/project.pbxproj +++ b/VDS.xcodeproj/project.pbxproj @@ -1171,7 +1171,7 @@ BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 41; + CURRENT_PROJECT_VERSION = 42; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; @@ -1208,7 +1208,7 @@ BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 41; + CURRENT_PROJECT_VERSION = 42; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1;