Fixed how NSMutableAttribute is used.

This commit is contained in:
Christiano, Kevin 2019-04-04 13:39:59 -04:00
parent 14d66d1fc6
commit baa0f3d3f7

View File

@ -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
}
}
}