From baa0f3d3f7bd5f0faa485924ddaa79fc0c1a41b6 Mon Sep 17 00:00:00 2001 From: "Christiano, Kevin" Date: Thu, 4 Apr 2019 13:39:59 -0400 Subject: [PATCH] Fixed how NSMutableAttribute is used. --- MVMCoreUI/Atoms/Views/LabelWithInternalButton.swift | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/LabelWithInternalButton.swift b/MVMCoreUI/Atoms/Views/LabelWithInternalButton.swift index cda4d6ec..2473bf85 100644 --- a/MVMCoreUI/Atoms/Views/LabelWithInternalButton.swift +++ b/MVMCoreUI/Atoms/Views/LabelWithInternalButton.swift @@ -28,17 +28,14 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt willSet(newAttributedText) { if let newAttribText = newAttributedText, !newAttribText.string.isEmpty { - let mutableAttributedText = newAttribText as? NSMutableAttributedString + let mutableAttributedText = NSMutableAttributedString(attributedString: newAttribText) let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.lineSpacing = CGFloat(LabelWithInternalButtonLineSpace) if newAttribText.length > 0 { - mutableAttributedText?.addAttribute(.paragraphStyle, value: paragraphStyle, range: NSRange(location: 0, length: newAttribText.length)) - } - - if let mutableAttText = mutableAttributedText { - label?.attributedText = mutableAttText + mutableAttributedText.addAttribute(.paragraphStyle, value: paragraphStyle, range: NSRange(location: 0, length: newAttribText.length)) } + label?.attributedText = mutableAttributedText } } }