From a4bec1d95617a1d0645e4c3bbcd4570405abdb43 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 19 Aug 2019 12:11:55 -0400 Subject: [PATCH] mild changes. --- MVMCoreUI/Atoms/Views/Label.swift | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/Label.swift b/MVMCoreUI/Atoms/Views/Label.swift index b2984a57..c46c16e8 100644 --- a/MVMCoreUI/Atoms/Views/Label.swift +++ b/MVMCoreUI/Atoms/Views/Label.swift @@ -237,9 +237,7 @@ public typealias ActionBlock = () -> () else { continue } let range = NSRange(location: location, length: length) - - print(attributeType) - + switch attributeType { case "underline": attributedString.addAttribute(.underlineStyle, value: NSUnderlineStyle.single.rawValue, range: range) @@ -581,15 +579,16 @@ extension UITapGestureRecognizer { return true } + // Must configure the attributed string to translate what would appear on screen to accurately analyze. guard let attributedText = label.attributedText else { return false } let paragraph = NSMutableParagraphStyle() paragraph.alignment = label.textAlignment - let newAttributedString = NSMutableAttributedString(attributedString: attributedText) - newAttributedString.addAttributes([NSAttributedString.Key.paragraphStyle: paragraph], range: NSRange(location: 0, length: attributedText.string.count)) + let stagedAttributedString = NSMutableAttributedString(attributedString: attributedText) + stagedAttributedString.addAttributes([NSAttributedString.Key.paragraphStyle: paragraph], range: NSRange(location: 0, length: attributedText.string.count)) - let textStorage = NSTextStorage(attributedString: newAttributedString) + let textStorage = NSTextStorage(attributedString: stagedAttributedString) let layoutManager = NSLayoutManager() let textContainer = NSTextContainer(size: .zero)