From efb51d12c42c342930c83b5f8f883bcc7763064d Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 30 Aug 2023 16:57:44 -0500 Subject: [PATCH] fixed badge Signed-off-by: Matt Bruce --- VDS/Components/Badge/Badge.swift | 8 ++++---- VDS/Components/Label/Label.swift | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/VDS/Components/Badge/Badge.swift b/VDS/Components/Badge/Badge.swift index 67bbae67..4d3101bb 100644 --- a/VDS/Components/Badge/Badge.swift +++ b/VDS/Components/Badge/Badge.swift @@ -57,16 +57,16 @@ open class Badge: View { /// This will render the badges fill color based on the available options. /// When used in conjunction with the surface prop, this fill color will change its tint automatically based on a light or dark surface. - open var fillColor: FillColor = .red { didSet { setNeedsUpdate() }} + open var fillColor: FillColor = .red { didSet { if oldValue != fillColor { setNeedsUpdate() } } } /// The text that will be shown in the label. - open var text: String = "" { didSet { setNeedsUpdate() }} + open var text: String = "" { didSet { if oldValue != text { setNeedsUpdate() } } } /// When applied, this property takes a px value that will restrict the width at that point. - open var maxWidth: CGFloat? { didSet { setNeedsUpdate() }} + open var maxWidth: CGFloat? { didSet { if oldValue != maxWidth { setNeedsUpdate() } } } /// This will restrict the badge height to a specific number of lines. If the text overflows the allowable space, ellipsis will show. - open var numberOfLines: Int = 1 { didSet { setNeedsUpdate() }} + open var numberOfLines: Int = 1 { didSet { if oldValue != numberOfLines { setNeedsUpdate() } } } //-------------------------------------------------- // MARK: - Constraints diff --git a/VDS/Components/Label/Label.swift b/VDS/Components/Label/Label.swift index 59640545..7c01add3 100644 --- a/VDS/Components/Label/Label.swift +++ b/VDS/Components/Label/Label.swift @@ -108,26 +108,26 @@ open class Label: UILabel, ViewProtocol, UserInfoable { open var useAttributedText: Bool = false /// Will determine if a scaled font should be used for the font. - open var useScaledFont: Bool = false { didSet { setNeedsUpdate() }} + open var useScaledFont: Bool = false { didSet { if oldValue != useScaledFont { setNeedsUpdate() } } } - open var surface: Surface = .light { didSet { setNeedsUpdate() }} + open var surface: Surface = .light { didSet { if oldValue != surface { setNeedsUpdate() } } } /// Array of LabelAttributeModel objects used in rendering the text. - open var attributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() }} + open var attributes: [any LabelAttributeModel]? { didSet { if oldValue != attributes { setNeedsUpdate() } } } /// TextStyle used on the this label. - open var textStyle: TextStyle = .defaultStyle { didSet { setNeedsUpdate() }} + open var textStyle: TextStyle = .defaultStyle { didSet { if oldValue != textStyle { setNeedsUpdate() } } } /// The alignment of the text within the label. - open override var textAlignment: NSTextAlignment { didSet { setNeedsUpdate() }} + open override var textAlignment: NSTextAlignment { didSet { if oldValue != textAlignment { setNeedsUpdate() } } } open var userInfo = [String: Primitive]() /// Number of lines the label can render out, default is set to 0. - open override var numberOfLines: Int { didSet { setNeedsUpdate() }} + open override var numberOfLines: Int { didSet { if oldValue != numberOfLines { setNeedsUpdate() } } } /// Line break mode for the label, default is set to word wrapping. - open override var lineBreakMode: NSLineBreakMode { didSet { setNeedsUpdate() }} + open override var lineBreakMode: NSLineBreakMode { didSet { if oldValue != lineBreakMode { setNeedsUpdate() } } } /// Text that will be used in the label. override open var text: String? { @@ -139,7 +139,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable { } /// Whether the View is enabled or not. - open override var isEnabled: Bool { didSet { setNeedsUpdate() } } + open override var isEnabled: Bool { didSet { if oldValue != isEnabled { setNeedsUpdate() } } } //-------------------------------------------------- // MARK: - Configuration Properties @@ -149,7 +149,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable { open var textColorConfiguration: AnyColorable = ViewColorConfiguration().with { $0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true) $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false) - }.eraseToAnyColorable(){ didSet { setNeedsUpdate() }} + }.eraseToAnyColorable(){ didSet { setNeedsUpdate() } } //-------------------------------------------------- // MARK: - Lifecycle