Thank you for this excellent handy library for text manipulation. It have really made most of my text management easy in a jiffy. But I am seeing a broken feature in iOS 14.
On iOS 14 Strikethrough attribute is not working when:
Spaces are used in the string
2 styles are used in a string
When strikethrough is added to one of the styles in a StyleGroup or StyleXML
I have added a sample controller code below which tries to set XML formatted Attributed String to a button's title
class ViewController: UIViewController {
@IBOutlet weak var testButton: UIButton!
var styleXML: StyleXML = {
let baseStyle = Style {
$0.font = UIFont.systemFont(ofSize: 17, weight: .regular)
$0.color = "#DD0000"
$0.alignment = .center
}
// Derives baseStyle and updates font weight
let boldStyle = baseStyle.byAdding {
$0.font = UIFont.systemFont(ofSize: 17, weight: .bold)
}
// Derives boldStyle and updates font weight, color and adds a strikethrough
let strikeStyle = boldStyle.byAdding {
$0.font = UIFont.systemFont(ofSize: 17, weight: .semibold)
$0.color = "#00DD00"
$0.strikethrough = (.single, "#0000BB")
}
let boldStrikeStyleGroup = StyleXML(base: baseStyle, ["bold": boldStyle, "strike": strikeStyle])
return boldStrikeStyleGroup
}()
override func viewDidLoad() {
super.viewDidLoad()
// Create a test string and set it button's attributed text
let attributedString = "<strike>15.99</strike> Buy now <bold>10.99</bold>".set(style: styleXML)
testButton.setAttributedTitle(attributedString, for: .normal)
}
}
Output of the following in iOS 13 and iOS 14 devices
iOS 13.2 on Simulator. The result is same on an actual device.
iOS 14 latest beta, iPhone 8 Plus
Kindly update and resolve.
I appreciate the efforts made to create this Library. Using in almost every project i have worked.
Thank you for this excellent handy library for text manipulation. It have really made most of my text management easy in a jiffy. But I am seeing a broken feature in iOS 14. On iOS 14 Strikethrough attribute is not working when:
I have added a sample controller code below which tries to set XML formatted Attributed String to a button's title
Output of the following in iOS 13 and iOS 14 devices
iOS 13.2 on Simulator. The result is same on an actual device.
iOS 14 latest beta, iPhone 8 Plus
Kindly update and resolve. I appreciate the efforts made to create this Library. Using in almost every project i have worked.