From 2854aea8c22213c1a8d867018718aa803928c6e6 Mon Sep 17 00:00:00 2001 From: Vasavi Kanamarlapudi Date: Wed, 18 Sep 2024 12:19:35 +0530 Subject: [PATCH] refactored naming Signed-off-by: Matt Bruce --- VDS.xcodeproj/project.pbxproj | 8 ++++---- VDS/Components/Footnote/FootnoteGroup.swift | 8 ++++---- .../{Footnote.swift => FootnoteItem.swift} | 14 ++++++-------- 3 files changed, 14 insertions(+), 16 deletions(-) rename VDS/Components/Footnote/{Footnote.swift => FootnoteItem.swift} (94%) diff --git a/VDS.xcodeproj/project.pbxproj b/VDS.xcodeproj/project.pbxproj index 67eb6f60..7090dcfd 100644 --- a/VDS.xcodeproj/project.pbxproj +++ b/VDS.xcodeproj/project.pbxproj @@ -21,7 +21,7 @@ 1855EC662BAABF2A002ACAC2 /* BreadcrumbItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1855EC652BAABF2A002ACAC2 /* BreadcrumbItemModel.swift */; }; 186D13CB2BBA8B1500986B53 /* DropdownSelect.swift in Sources */ = {isa = PBXBuildFile; fileRef = 186D13CA2BBA8B1500986B53 /* DropdownSelect.swift */; }; 18792A902B7431F2008C0D29 /* ButtonIconBadgeIndicatorModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18792A8F2B7431F2008C0D29 /* ButtonIconBadgeIndicatorModel.swift */; }; - 18926F5B2C7616A500C55BF6 /* Footnote.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18926F5A2C7616A500C55BF6 /* Footnote.swift */; }; + 18926F5B2C7616A500C55BF6 /* FootnoteItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18926F5A2C7616A500C55BF6 /* FootnoteItem.swift */; }; 18926F5D2C7616C600C55BF6 /* FootnoteChangeLog.txt in Resources */ = {isa = PBXBuildFile; fileRef = 18926F5C2C7616C600C55BF6 /* FootnoteChangeLog.txt */; }; 18A3F12A2BD9298900498E4A /* Calendar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18A3F1292BD9298900498E4A /* Calendar.swift */; }; 18A65A022B96E848006602CC /* Breadcrumbs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18A65A012B96E848006602CC /* Breadcrumbs.swift */; }; @@ -233,7 +233,7 @@ 186D13CA2BBA8B1500986B53 /* DropdownSelect.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DropdownSelect.swift; sourceTree = ""; }; 186D13CE2BBC36EE00986B53 /* DropdownSelectChangeLog.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = DropdownSelectChangeLog.txt; sourceTree = ""; }; 18792A8F2B7431F2008C0D29 /* ButtonIconBadgeIndicatorModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonIconBadgeIndicatorModel.swift; sourceTree = ""; }; - 18926F5A2C7616A500C55BF6 /* Footnote.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Footnote.swift; sourceTree = ""; }; + 18926F5A2C7616A500C55BF6 /* FootnoteItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FootnoteItem.swift; sourceTree = ""; }; 18926F5C2C7616C600C55BF6 /* FootnoteChangeLog.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = FootnoteChangeLog.txt; sourceTree = ""; }; 18A3F1292BD9298900498E4A /* Calendar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Calendar.swift; sourceTree = ""; }; 18A65A012B96E848006602CC /* Breadcrumbs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Breadcrumbs.swift; sourceTree = ""; }; @@ -505,7 +505,7 @@ 18926F592C76168300C55BF6 /* Footnote */ = { isa = PBXGroup; children = ( - 18926F5A2C7616A500C55BF6 /* Footnote.swift */, + 18926F5A2C7616A500C55BF6 /* FootnoteItem.swift */, 183B16F62C80B32200BA6A10 /* FootnoteGroup.swift */, 18926F5C2C7616C600C55BF6 /* FootnoteChangeLog.txt */, ); @@ -1328,7 +1328,7 @@ 18B463A42BBD3C46005C4528 /* DropdownOptionModel.swift in Sources */, EAF2F4762C231EAA007BFEDC /* AccessibilityActionElement.swift in Sources */, EAC58BFD2BE935C300BA39FA /* TitleLockupTextColor.swift in Sources */, - 18926F5B2C7616A500C55BF6 /* Footnote.swift in Sources */, + 18926F5B2C7616A500C55BF6 /* FootnoteItem.swift in Sources */, EAACB89A2B927108006A3869 /* Valuing.swift in Sources */, EAE785312BA0A438009428EA /* UIImage+Helper.swift in Sources */, EAF193422C134F3400C68D18 /* Table.swift in Sources */, diff --git a/VDS/Components/Footnote/FootnoteGroup.swift b/VDS/Components/Footnote/FootnoteGroup.swift index 9660f440..693639ee 100644 --- a/VDS/Components/Footnote/FootnoteGroup.swift +++ b/VDS/Components/Footnote/FootnoteGroup.swift @@ -42,7 +42,7 @@ open class FootnoteGroup: View { // MARK: - Public Properties //-------------------------------------------------- /// Array of ``Footnote`` for the Footnote items. - open var footnoteItems: [Footnote] = [] { didSet { setNeedsUpdate() } } + open var footnoteItems: [FootnoteItem] = [] { didSet { setNeedsUpdate() } } /// Any percentage or pixel value and cannot exceed container size. /// If there is a width that is larger than container size, the footnote will resize to container's width. @@ -132,7 +132,7 @@ open class FootnoteGroup: View { var symbolMaxWidth = 0.0 if footnoteItems.count > 0 { for index in 0...footnoteItems.count - 1 { - let footnote: Footnote = footnoteItems[index] + let footnote: FootnoteItem = footnoteItems[index] let separatorWidth = Label().with { $0.text = footnote.symbolType; $0.sizeToFit() }.intrinsicContentSize.width symbolMaxWidth = separatorWidth > symbolMaxWidth ? separatorWidth : symbolMaxWidth } @@ -142,8 +142,8 @@ open class FootnoteGroup: View { // add symbol label, text label to stack. if footnoteItems.count > 0 { for index in 0...footnoteItems.count - 1 { - let footnote: Footnote = footnoteItems[index] - footnote.symbolWiderWidth = symbolMaxWidth + let footnote: FootnoteItem = footnoteItems[index] + footnote.symbolWidth = symbolMaxWidth footnote.surface = surface stackView.addArrangedSubview(footnote) } diff --git a/VDS/Components/Footnote/Footnote.swift b/VDS/Components/Footnote/FootnoteItem.swift similarity index 94% rename from VDS/Components/Footnote/Footnote.swift rename to VDS/Components/Footnote/FootnoteItem.swift index 0de37b45..ebd6e6ab 100644 --- a/VDS/Components/Footnote/Footnote.swift +++ b/VDS/Components/Footnote/FootnoteItem.swift @@ -12,8 +12,8 @@ import VDSCoreTokens /// A footnote is text that provides supporting details, legal copy and links to related content. /// It exists at the bottom or "foot" of a page or section. @objcMembers -@objc(VDSFootnote) -open class Footnote: View { +@objc(VDSFootnoteItem) +open class FootnoteItem: View { //-------------------------------------------------- // MARK: - Initializers @@ -122,7 +122,7 @@ open class Footnote: View { } /// To set the widest symbol width from the symbol container in the group. - open var symbolWiderWidth: CGFloat = 0 { didSet { setNeedsUpdate() } } + internal var symbolWidth: CGFloat? { didSet { setNeedsUpdate() } } //-------------------------------------------------- // MARK: - Private Properties @@ -210,7 +210,6 @@ open class Footnote: View { super.updateView() // Update symbolLabel - symbolWidthConstraint?.isActive = false symbolLabel.text = symbolType symbolLabel.isHidden = hideSymbol symbolLabel.textColor = kind.colorConfiguration.getColor(self) @@ -218,13 +217,12 @@ open class Footnote: View { symbolLabel.surface = surface //Set width to the symbol label - if symbolWiderWidth > 0 { + if let symbolWidth, symbolWidth > 0 { // Set the widest symbol width from the symbol container in the group. - symbolWidthConstraint = symbolLabel.widthAnchor.constraint(equalToConstant: symbolWiderWidth) + symbolWidthConstraint?.constant = symbolWidth } else { - symbolWidthConstraint = symbolLabel.widthAnchor.constraint(equalToConstant: symbolLabel.intrinsicContentSize.width) + symbolWidthConstraint?.constant = symbolLabel.intrinsicContentSize.width } - symbolWidthConstraint?.isActive = true // Update textLabel textLabel.text = text