fixed bug for the Label

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-03-13 10:41:06 -05:00
parent 10fdd6bcb8
commit 413d5567af

View File

@ -133,10 +133,12 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
open override var lineBreakMode: NSLineBreakMode { didSet { setNeedsUpdate() }} open override var lineBreakMode: NSLineBreakMode { didSet { setNeedsUpdate() }}
/// Text that will be used in the label. /// Text that will be used in the label.
private var _text: String!
override open var text: String! { override open var text: String! {
get { super.text } get { _text }
set { set {
textSetMode = .text textSetMode = .text
_text = newValue
styleText(newValue) styleText(newValue)
} }
} }
@ -278,7 +280,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
//-------------------------------------------------- //--------------------------------------------------
private func restyleText() { private func restyleText() {
if textSetMode == .text { if textSetMode == .text {
styleText(text) styleText(_text)
} else { } else {
styleAttributedText(attributedText) styleAttributedText(attributedText)
} }
@ -304,10 +306,9 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
lineBreakMode: lineBreakMode) lineBreakMode: lineBreakMode)
applyAttributes(mutableText) applyAttributes(mutableText)
// Set attributed text to match typography // Set attributed text to match typography
super.attributedText = mutableText super.attributedText = mutableText
} }
private func styleAttributedText(_ newValue: NSAttributedString?) { private func styleAttributedText(_ newValue: NSAttributedString?) {