mild changes.

This commit is contained in:
Kevin G Christiano 2019-08-19 12:11:55 -04:00
parent abde89f06f
commit a4bec1d956

View File

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