diff --git a/MVMCoreUI/Atoms/Views/LabelWithInternalButton.swift b/MVMCoreUI/Atoms/Views/LabelWithInternalButton.swift index 1ebe425e..46f64280 100644 --- a/MVMCoreUI/Atoms/Views/LabelWithInternalButton.swift +++ b/MVMCoreUI/Atoms/Views/LabelWithInternalButton.swift @@ -24,8 +24,6 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt public var actionBlock: ActionBlock? public weak var label: MFLabel? - // FIXME: I think there are scenarios where attributed text is being set with attributes but there is no text to set. - public var attributedText: NSAttributedString? { didSet(newAttributedText) { if let newAttribText = newAttributedText, !newAttribText.string.isEmpty { @@ -82,14 +80,14 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt public var backText: String? public var text: String? { - didSet(newText) { - if newText != nil { + willSet(newText) { +// if newText != nil { attributedText = NSAttributedString(string: newText ?? "") setAlternateNormalTextAttributes([NSAttributedString.Key.font: normalTextFont as Any]) setAlternateActionTextAttributes([NSAttributedString.Key.font: actionTextFont as Any]) setAlternateNormalTextAttributes([NSAttributedString.Key.foregroundColor: normalTextColor as Any]) setAlternateActionTextAttributes([NSAttributedString.Key.foregroundColor: actionTextColor as Any]) - } +// } } } @@ -196,7 +194,7 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt label.sizeToFit() } - //adding the underline + // Adding the underline setAlternateActionTextAttributes([NSAttributedString.Key.underlineStyle: NSNumber(value: NSUnderlineStyle.single.rawValue)]) self.label?.attributedText = attributedText @@ -423,6 +421,7 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt self.text = getTextFromStringComponents() } + self.text = actionRange.revisedText setup() } @@ -439,9 +438,8 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt fullText = fullText.replacingOccurrences(of: rightBrace, with: "") } - self.text = fullText - actionRange.revisedText = fullText + actionRange.revisedText = fullText return actionRange }