From cb8ad83149fa7fea5cc1c33683544bb5938e06e2 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 21 Jun 2019 13:34:02 -0400 Subject: [PATCH] fix label overriding itself --- MVMCoreUI/Atoms/Views/Label.swift | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/Label.swift b/MVMCoreUI/Atoms/Views/Label.swift index a0733521..4fa300a2 100644 --- a/MVMCoreUI/Atoms/Views/Label.swift +++ b/MVMCoreUI/Atoms/Views/Label.swift @@ -247,10 +247,11 @@ public typealias ActionBlock = () -> Void case "action": guard let actionLabel = label as? Label else { continue } - actionLabel.addTappableLinkAttribute(range: range, - actionMap: json, - additionalData: additionalData, - delegateObject: delegate) + actionLabel.addDefaultAttributes(range: range, string: attributedString) + actionLabel.clauses.append(ActionableClause(range: range, + actionBlock: actionLabel.createActionBlockFrom(actionMap: json, + additionalData: additionalData, + delegateObject: delegate))) default: continue } @@ -397,6 +398,13 @@ extension Label { } } + func addDefaultAttributes(range: NSRange, string: NSAttributedString?) { + + guard let string = string else { return } + let mutableAttributedString = NSMutableAttributedString(attributedString: string) + mutableAttributedString.addAttributes([NSAttributedString.Key.underlineStyle: NSUnderlineStyle.single.rawValue], range: range) + } + fileprivate func setDefaultAttributes(range: NSRange) { guard let attributedText = attributedText else { return }