diff --git a/VDS/Components/Breadcrumbs/BreadcrumbItemModel.swift b/VDS/Components/Breadcrumbs/BreadcrumbItemModel.swift index 2c73f24f..be4419cc 100644 --- a/VDS/Components/Breadcrumbs/BreadcrumbItemModel.swift +++ b/VDS/Components/Breadcrumbs/BreadcrumbItemModel.swift @@ -8,8 +8,7 @@ import Foundation extension Breadcrumbs { - public struct BreadcrumbItemModel { - + public struct BreadcrumbItemModel: Equatable { ///Text that goes in the breadcrumb item public var text: String @@ -24,5 +23,10 @@ extension Breadcrumbs { self.selected = selected self.onClick = onClick } + + public static func == (lhs: Breadcrumbs.BreadcrumbItemModel, rhs: Breadcrumbs.BreadcrumbItemModel) -> Bool { + lhs.text == rhs.text + && lhs.selected == rhs.selected + } } } diff --git a/VDS/Components/Calendar/CalendarIndicatorModel.swift b/VDS/Components/Calendar/CalendarIndicatorModel.swift index 04ad9714..185af749 100644 --- a/VDS/Components/Calendar/CalendarIndicatorModel.swift +++ b/VDS/Components/Calendar/CalendarIndicatorModel.swift @@ -9,7 +9,7 @@ import Foundation /// Custom data type for indicators prop extension CalendarBase { - public struct CalendarIndicatorModel { + public struct CalendarIndicatorModel: Equatable { /// Text that shown to an indicator for legend public var label: String diff --git a/VDS/Components/Carousel/CarouselPaginationModel.swift b/VDS/Components/Carousel/CarouselPaginationModel.swift index ab85d6a4..67ba5052 100644 --- a/VDS/Components/Carousel/CarouselPaginationModel.swift +++ b/VDS/Components/Carousel/CarouselPaginationModel.swift @@ -10,7 +10,7 @@ import UIKit /// Custom data type for pagination prop for 'Carousel' component. extension Carousel { - public struct CarouselPaginationModel { + public struct CarouselPaginationModel: Equatable { /// Pagination supports Button icon property 'kind'. public var kind: ButtonIcon.Kind diff --git a/VDS/Components/Carousel/CarouselSlotAlignmentModel.swift b/VDS/Components/Carousel/CarouselSlotAlignmentModel.swift index ee1d491b..9774baa2 100644 --- a/VDS/Components/Carousel/CarouselSlotAlignmentModel.swift +++ b/VDS/Components/Carousel/CarouselSlotAlignmentModel.swift @@ -11,7 +11,7 @@ import Foundation extension Carousel { /// Used only when slot content have different heights or widths. - public struct CarouselSlotAlignmentModel { + public struct CarouselSlotAlignmentModel: Equatable { /// Used for vertical alignment of slot alignment. public var vertical: Carousel.Vertical diff --git a/VDS/Components/Checkbox/CheckboxGroup.swift b/VDS/Components/Checkbox/CheckboxGroup.swift index f2a62efa..9967bcd0 100644 --- a/VDS/Components/Checkbox/CheckboxGroup.swift +++ b/VDS/Components/Checkbox/CheckboxGroup.swift @@ -108,8 +108,8 @@ open class CheckboxGroup: SelectorGroupBase, SelectorGroupMultiSel } extension CheckboxGroup { - public struct CheckboxItemModel : Surfaceable, Initable, Errorable { - + public struct CheckboxItemModel : Surfaceable, Initable, Errorable, Equatable { + /// Whether this object is enabled or not public var enabled: Bool /// Current Surface and this is used to pass down to child objects that implement Surfacable @@ -146,6 +146,21 @@ extension CheckboxGroup { public init() { self.init(enabled: true) } + + public static func == (lhs: CheckboxGroup.CheckboxItemModel, rhs: CheckboxGroup.CheckboxItemModel) -> Bool { + lhs.enabled == rhs.enabled + && lhs.surface == rhs.surface + && lhs.inputId == rhs.inputId + && lhs.value == rhs.value + && lhs.accessibileText == rhs.accessibileText + && lhs.labelText == rhs.labelText + && lhs.labelTextAttributes == rhs.labelTextAttributes + && lhs.childText == rhs.childText + && lhs.childTextAttributes == rhs.childTextAttributes + && lhs.selected == rhs.selected + && lhs.showError == rhs.showError + && lhs.errorText == rhs.errorText + } } } diff --git a/VDS/Components/DatePicker/DatePickerCalendarModel.swift b/VDS/Components/DatePicker/DatePickerCalendarModel.swift index da18ab2f..84a392ad 100644 --- a/VDS/Components/DatePicker/DatePickerCalendarModel.swift +++ b/VDS/Components/DatePicker/DatePickerCalendarModel.swift @@ -9,7 +9,7 @@ import Foundation import UIKit extension DatePicker { - public struct CalendarModel { + public struct CalendarModel: Equatable { /// If set to true, the calendar will not have a border. public let hideContainerBorder: Bool diff --git a/VDS/Components/DropdownSelect/DropdownOptionModel.swift b/VDS/Components/DropdownSelect/DropdownOptionModel.swift index c82519eb..76ac8f5d 100644 --- a/VDS/Components/DropdownSelect/DropdownOptionModel.swift +++ b/VDS/Components/DropdownSelect/DropdownOptionModel.swift @@ -8,7 +8,7 @@ import Foundation extension DropdownSelect { - public struct DropdownOptionModel { + public struct DropdownOptionModel: Equatable { /// Text that goes as option to DropdownSelect public var text: String diff --git a/VDS/Components/Icon/ButtonIcon/ButtonIconBadgeIndicatorModel.swift b/VDS/Components/Icon/ButtonIcon/ButtonIconBadgeIndicatorModel.swift index 28d731b0..f683ebf4 100644 --- a/VDS/Components/Icon/ButtonIcon/ButtonIconBadgeIndicatorModel.swift +++ b/VDS/Components/Icon/ButtonIcon/ButtonIconBadgeIndicatorModel.swift @@ -10,7 +10,7 @@ import Foundation extension ButtonIcon { //Model that represents the options available for the Badge Indicator - public struct BadgeIndicatorModel { + public struct BadgeIndicatorModel: Equatable { /// Enum used to describe the badge indicator direction of icon button determining the expand direction. public enum ExpandDirection: String, CaseIterable { case right, center, left diff --git a/VDS/Components/Icon/IconName.swift b/VDS/Components/Icon/IconName.swift index c3943d64..a6e951df 100644 --- a/VDS/Components/Icon/IconName.swift +++ b/VDS/Components/Icon/IconName.swift @@ -24,7 +24,7 @@ extension Icon { /// let icon = Icon() /// icon.name = .foo /// ``` - public struct Name: RawRepresentable { + public struct Name: RawRepresentable, Equatable { public typealias RawValue = String public var rawValue: String diff --git a/VDS/Components/Notification/NotificationButtonModel.swift b/VDS/Components/Notification/NotificationButtonModel.swift index 6876aa7c..c714dbd7 100644 --- a/VDS/Components/Notification/NotificationButtonModel.swift +++ b/VDS/Components/Notification/NotificationButtonModel.swift @@ -8,12 +8,16 @@ import Foundation extension Notification { - public struct ButtonModel { + public struct ButtonModel: Equatable { public var text: String public var onClick: (Button) -> () public init(text: String, onClick: @escaping (Button) -> Void) { self.text = text self.onClick = onClick } + + public static func == (lhs: Notification.ButtonModel, rhs: Notification.ButtonModel) -> Bool { + lhs.text == rhs.text + } } } diff --git a/VDS/Components/RadioBox/RadioBoxGroup.swift b/VDS/Components/RadioBox/RadioBoxGroup.swift index 3b17d7d8..484b213f 100644 --- a/VDS/Components/RadioBox/RadioBoxGroup.swift +++ b/VDS/Components/RadioBox/RadioBoxGroup.swift @@ -113,7 +113,7 @@ open class RadioBoxGroup: SelectorGroupBase, SelectorGroupSingleSe } extension RadioBoxGroup { - public struct RadioBoxItemModel: Surfaceable, Initable, FormFieldable { + public struct RadioBoxItemModel: Surfaceable, Initable, FormFieldable, Equatable { /// Whether this object is enabled or not public var enabled: Bool /// Current Surface and this is used to pass down to child objects that implement Surfacable @@ -158,5 +158,22 @@ extension RadioBoxGroup { public init() { self.init(enabled: true) } + + public static func == (lhs: RadioBoxGroup.RadioBoxItemModel, rhs: RadioBoxGroup.RadioBoxItemModel) -> Bool { + lhs.enabled == rhs.enabled + && lhs.surface == rhs.surface + && lhs.inputId == rhs.inputId + && lhs.value == rhs.value + && lhs.accessibileText == rhs.accessibileText + && lhs.text == rhs.text + && lhs.textAttributes == rhs.textAttributes + && lhs.subText == rhs.subText + && lhs.subTextAttributes == rhs.subTextAttributes + && lhs.subTextRight == rhs.subTextRight + && lhs.subTextRightAttributes == rhs.subTextRightAttributes + && lhs.selected == rhs.selected + && lhs.strikethrough == rhs.strikethrough + && lhs.strikethroughAccessibileText == rhs.strikethroughAccessibileText + } } } diff --git a/VDS/Components/RadioButton/RadioButtonGroup.swift b/VDS/Components/RadioButton/RadioButtonGroup.swift index 8bde87de..bbd23209 100644 --- a/VDS/Components/RadioButton/RadioButtonGroup.swift +++ b/VDS/Components/RadioButton/RadioButtonGroup.swift @@ -103,7 +103,7 @@ open class RadioButtonGroup: SelectorGroupBase, SelectorGroupSi } extension RadioButtonGroup { - public struct RadioButtonItemModel: Surfaceable, Initable, FormFieldable, Errorable { + public struct RadioButtonItemModel: Surfaceable, Initable, FormFieldable, Errorable, Equatable { /// Whether this object is enabled or not public var enabled: Bool @@ -141,5 +141,20 @@ extension RadioButtonGroup { public init() { self.init(enabled: true) } + + public static func == (lhs: RadioButtonGroup.RadioButtonItemModel, rhs: RadioButtonGroup.RadioButtonItemModel) -> Bool { + lhs.enabled == rhs.enabled + && lhs.surface == rhs.surface + && lhs.inputId == rhs.inputId + && lhs.value == rhs.value + && lhs.accessibileText == rhs.accessibileText + && lhs.labelText == rhs.labelText + && lhs.labelTextAttributes == rhs.labelTextAttributes + && lhs.childText == rhs.childText + && lhs.childTextAttributes == rhs.childTextAttributes + && lhs.selected == rhs.selected + && lhs.showError == rhs.showError + && lhs.errorText == rhs.errorText + } } } diff --git a/VDS/Components/Table/TableItemModel.swift b/VDS/Components/Table/TableItemModel.swift index 47a8e3f2..4725ad73 100644 --- a/VDS/Components/Table/TableItemModel.swift +++ b/VDS/Components/Table/TableItemModel.swift @@ -10,7 +10,7 @@ import UIKit import VDSCoreTokens /// Model that represent the content of each cell of Table component -public struct TableItemModel { +public struct TableItemModel: Equatable { public let defaultHeight: CGFloat = 50.0 diff --git a/VDS/Components/Table/TableRowModel.swift b/VDS/Components/Table/TableRowModel.swift index 22f428ce..d9472372 100644 --- a/VDS/Components/Table/TableRowModel.swift +++ b/VDS/Components/Table/TableRowModel.swift @@ -7,7 +7,7 @@ import Foundation -public struct TableRowModel { +public struct TableRowModel: Equatable { public var columns: [TableItemModel] diff --git a/VDS/Components/Tabs/TabModel.swift b/VDS/Components/Tabs/TabModel.swift index 02f5bd43..959569a0 100644 --- a/VDS/Components/Tabs/TabModel.swift +++ b/VDS/Components/Tabs/TabModel.swift @@ -8,7 +8,7 @@ import Foundation extension Tabs { - public struct TabModel { + public struct TabModel: Equatable { ///Text that goes in the Tab public var text: String @@ -24,5 +24,10 @@ extension Tabs { self.onClick = onClick self.width = width } + + public static func == (lhs: Tabs.TabModel, rhs: Tabs.TabModel) -> Bool { + lhs.text == rhs.text + && lhs.width == rhs.width + } } } diff --git a/VDS/Components/TileContainer/TileContainer.swift b/VDS/Components/TileContainer/TileContainer.swift index 6c695112..c464d2b7 100644 --- a/VDS/Components/TileContainer/TileContainer.swift +++ b/VDS/Components/TileContainer/TileContainer.swift @@ -82,10 +82,25 @@ open class TileContainerBase: View where } /// Enum used to describe the background effect choices used for this component. - public enum BackgroundEffect { + public enum BackgroundEffect: Equatable { case transparency case gradient(UIColor, UIColor) case none + + public static func == (lhs: TileContainerBase.BackgroundEffect, rhs: TileContainerBase.BackgroundEffect) -> Bool { + lhs.description == lhs.description + } + + public var description: String { + switch self { + case .transparency: + "transparency" + case .gradient(let first, let second): + "gradient(\(first), \(second)" + case .none: + "none" + } + } } /// Enum used to describe the aspect ratios used for this component. diff --git a/VDS/Components/Tilelet/TileletBadgeModel.swift b/VDS/Components/Tilelet/TileletBadgeModel.swift index 9dbd03fe..90c523da 100644 --- a/VDS/Components/Tilelet/TileletBadgeModel.swift +++ b/VDS/Components/Tilelet/TileletBadgeModel.swift @@ -11,7 +11,7 @@ import UIKit extension Tilelet { /// Model that represents the options available for the badge. - public struct BadgeModel { + public struct BadgeModel: Equatable { /// Text that will be used for the badge. public var text: String = "" diff --git a/VDS/Components/Tilelet/TileletIconModels.swift b/VDS/Components/Tilelet/TileletIconModels.swift index 03b2d225..c30f0937 100644 --- a/VDS/Components/Tilelet/TileletIconModels.swift +++ b/VDS/Components/Tilelet/TileletIconModels.swift @@ -32,7 +32,7 @@ extension Tilelet { } /// Model that represents the options available for the descriptive icon. - public struct DescriptiveIcon { + public struct DescriptiveIcon: Equatable { /// A representation that will be used to render the icon with corresponding name. public var name: Icon.Name @@ -58,7 +58,7 @@ extension Tilelet { } /// Model that represents the options available for the directional icon. - public struct DirectionalIcon { + public struct DirectionalIcon: Equatable { public enum IconType: String, CaseIterable { case rightArrow case externalLink diff --git a/VDS/Components/Tilelet/TileletSubTitleModel.swift b/VDS/Components/Tilelet/TileletSubTitleModel.swift index 4c48cc3a..9850209c 100644 --- a/VDS/Components/Tilelet/TileletSubTitleModel.swift +++ b/VDS/Components/Tilelet/TileletSubTitleModel.swift @@ -10,7 +10,7 @@ import UIKit extension Tilelet { /// Model that represents the options available for the sub title label. - public struct SubTitleModel { + public struct SubTitleModel: Equatable { //-------------------------------------------------- // MARK: - Enums //-------------------------------------------------- @@ -67,5 +67,13 @@ extension Tilelet { textAttributes: textAttributes, lineBreakMode: lineBreakMode) } + + public static func == (lhs: Tilelet.SubTitleModel, rhs: Tilelet.SubTitleModel) -> Bool { + lhs.text == rhs.text + && lhs.textColor == rhs.textColor + && lhs.otherStandardStyle == rhs.otherStandardStyle + && lhs.textAttributes == rhs.textAttributes + && lhs.lineBreakMode == rhs.lineBreakMode + } } } diff --git a/VDS/Components/Tilelet/TileletTitleModel.swift b/VDS/Components/Tilelet/TileletTitleModel.swift index b9bc7bbe..877463c6 100644 --- a/VDS/Components/Tilelet/TileletTitleModel.swift +++ b/VDS/Components/Tilelet/TileletTitleModel.swift @@ -10,7 +10,7 @@ import UIKit extension Tilelet { /// Model that represents the options available for the title label. - public struct TitleModel { + public struct TitleModel: Equatable { //-------------------------------------------------- // MARK: - Enums //-------------------------------------------------- @@ -75,5 +75,14 @@ extension Tilelet { standardStyle: standardStyle.value, lineBreakMode: lineBreakMode) } + + public static func == (lhs: Tilelet.TitleModel, rhs: Tilelet.TitleModel) -> Bool { + lhs.text == rhs.text + && lhs.textColor == rhs.textColor + && lhs.isBold == rhs.isBold + && lhs.textAttributes == rhs.textAttributes + && lhs.standardStyle == rhs.standardStyle + && lhs.lineBreakMode == rhs.lineBreakMode + } } } diff --git a/VDS/Components/Tilelet/TiletEyebrowModel.swift b/VDS/Components/Tilelet/TiletEyebrowModel.swift index 3d22ab74..3c771d56 100644 --- a/VDS/Components/Tilelet/TiletEyebrowModel.swift +++ b/VDS/Components/Tilelet/TiletEyebrowModel.swift @@ -11,7 +11,7 @@ import UIKit extension Tilelet { /// Model that represents the options available for the eyebrow label. - public struct EyebrowModel { + public struct EyebrowModel: Equatable { //-------------------------------------------------- // MARK: - Public Properties //-------------------------------------------------- @@ -60,5 +60,14 @@ extension Tilelet { standardStyle: standardStyle.value, textAttributes: textAttributes) } + + public static func == (lhs: Tilelet.EyebrowModel, rhs: Tilelet.EyebrowModel) -> Bool { + lhs.text == rhs.text + && lhs.textColor == rhs.textColor + && lhs.isBold == rhs.isBold + && lhs.textAttributes == rhs.textAttributes + && lhs.standardStyle == rhs.standardStyle + && lhs.lineBreakMode == rhs.lineBreakMode + } } } diff --git a/VDS/Components/TitleLockup/TitleLockupEyebrowModel.swift b/VDS/Components/TitleLockup/TitleLockupEyebrowModel.swift index 1139a6ee..d789205f 100644 --- a/VDS/Components/TitleLockup/TitleLockupEyebrowModel.swift +++ b/VDS/Components/TitleLockup/TitleLockupEyebrowModel.swift @@ -9,7 +9,7 @@ import Foundation extension TitleLockup { /// Model that represents the options available for the eyebrow label. - public struct EyebrowModel { + public struct EyebrowModel: Equatable { /// Text that will be used for the eyebrow label. public var text: String @@ -44,6 +44,15 @@ extension TitleLockup { /// Text style that will be used for the eyebrow label. public var textStyle: TextStyle { isBold ? standardStyle.value.bold : standardStyle.value.regular } + + public static func == (lhs: TitleLockup.EyebrowModel, rhs: TitleLockup.EyebrowModel) -> Bool { + lhs.text == rhs.text + && lhs.textColor == rhs.textColor + && lhs.isBold == rhs.isBold + && lhs.standardStyle == rhs.standardStyle + && lhs.textAttributes == rhs.textAttributes + && lhs.numberOfLines == rhs.numberOfLines + } } } diff --git a/VDS/Components/TitleLockup/TitleLockupSubTitleModel.swift b/VDS/Components/TitleLockup/TitleLockupSubTitleModel.swift index 7dcbfb85..fefb384e 100644 --- a/VDS/Components/TitleLockup/TitleLockupSubTitleModel.swift +++ b/VDS/Components/TitleLockup/TitleLockupSubTitleModel.swift @@ -46,6 +46,14 @@ extension TitleLockup { /// TextStyle used to render the text. public var textStyle: TextStyle { otherStandardStyle.value.regular } + public static func == (lhs: TitleLockup.SubTitleModel, rhs: TitleLockup.SubTitleModel) -> Bool { + lhs.text == rhs.text + && lhs.textColor == rhs.textColor + && lhs.otherStandardStyle == rhs.otherStandardStyle + && lhs.textAttributes == rhs.textAttributes + && lhs.lineBreakMode == rhs.lineBreakMode + && lhs.numberOfLines == rhs.numberOfLines + } } } diff --git a/VDS/Components/TitleLockup/TitleLockupTitleModel.swift b/VDS/Components/TitleLockup/TitleLockupTitleModel.swift index 2d7f7405..2dc431ed 100644 --- a/VDS/Components/TitleLockup/TitleLockupTitleModel.swift +++ b/VDS/Components/TitleLockup/TitleLockupTitleModel.swift @@ -10,7 +10,7 @@ import UIKit extension TitleLockup { /// Model that represents the options available for the sub title label. - public struct TitleModel { + public struct TitleModel: Equatable { /// Text that will be used for the title label. public var text: String @@ -51,5 +51,14 @@ extension TitleLockup { /// TextStyle used to render the text. public var textStyle: TextStyle { isBold ? standardStyle.value.bold : standardStyle.value.regular } + public static func == (lhs: TitleLockup.TitleModel, rhs: TitleLockup.TitleModel) -> Bool { + lhs.text == rhs.text + && lhs.textColor == rhs.textColor + && lhs.isBold == rhs.isBold + && lhs.standardStyle == rhs.standardStyle + && lhs.textAttributes == rhs.textAttributes + && lhs.numberOfLines == rhs.numberOfLines + && lhs.lineBreakMode == rhs.lineBreakMode + } } } diff --git a/VDS/Components/Tooltip/TooltipModel.swift b/VDS/Components/Tooltip/TooltipModel.swift index 461fda66..9c3e1576 100644 --- a/VDS/Components/Tooltip/TooltipModel.swift +++ b/VDS/Components/Tooltip/TooltipModel.swift @@ -11,7 +11,7 @@ import UIKit extension Tooltip { /// Model used to represent the tooltip. - public struct TooltipModel { + public struct TooltipModel: Equatable { /// Current Surface and this is used to pass down to child objects that implement Surfacable public var closeButtonText: String public var title: String?