From 5bac63324ff0e34d3a8d9b6e5afc6b1a302d42d6 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 1 Oct 2020 14:45:18 -0400 Subject: [PATCH] update --- .../Atomic/Atoms/Views/Label/Label.swift | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift index 62af450d..bea0dfea 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift @@ -252,8 +252,6 @@ public typealias ActionBlock = () -> () originalAttributedString = nil text = labelModel.text - print("SET before:\n \(attributedText)") - /* * This is to address a reuse issue with iOS 13 and up. * Even if you set text & attributedText to nil, the moment you set text with a value, @@ -262,15 +260,15 @@ public typealias ActionBlock = () -> () * Only other reference found of issue: https://www.thetopsites.net/article/58142205.shtml */ if #available(iOS 13, *) { - // Case where no attributes are set in the model but attributedText has a value. if let attributedText = attributedText, let text = text { let attributedString = NSMutableAttributedString(string: text) - for attributes in attributedText.attributes(at: 0, effectiveRange: nil) { - if attributes.key == .underlineStyle { - attributedString.addAttribute(.underlineStyle, value: 0, range: NSRange(location: 0, length: text.count)) + let range = NSRange(location: 0, length: text.count) + for attribute in attributedText.attributes(at: 0, effectiveRange: nil) { + if attribute.key == .underlineStyle { + attributedString.addAttribute(.underlineStyle, value: 0, range: range) } - if attributes.key == .strikethroughStyle { - attributedString.addAttribute(.strikethroughStyle, value: 0, range: NSRange(location: 0, length: text.count)) + if attribute.key == .strikethroughStyle { + attributedString.addAttribute(.strikethroughStyle, value: 0, range: range) } } @@ -278,8 +276,6 @@ public typealias ActionBlock = () -> () } } - print("SET after:\n \(attributedText)") - hero = labelModel.hero Label.setLabel(self, withHTML: labelModel.html) isAccessibilityElement = hasText @@ -394,9 +390,7 @@ public typealias ActionBlock = () -> () attributedText = attributedString originalAttributedString = attributedText - print("SET new attribute:\n \(attributedText)") } - print("SET DONE FUNC:\n \(attributedText)") } @objc public static func setUILabel(_ label: UILabel?, withJSON json: [AnyHashable: Any]?, delegate: DelegateObject?, additionalData: [AnyHashable: Any]?) { @@ -787,7 +781,6 @@ extension Label { public func reset() { text = nil attributedText = nil - print("reset:\n \(attributedText)") hero = nil textAlignment = .left originalAttributedString = nil