From e52ae195f3db4cfc5c2f7998303547e171ec74a7 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 12 Sep 2023 14:04:05 -0500 Subject: [PATCH] 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