I'm trying to use replaceCharacters(in:with:) of NSMutableAttributedString to replace a substring and apply different attributes. The problem is strikethroughStyle is not rendered for that substring.
Here, I can see that the color of the substring "mars" is changed, but there is no strikethrough line.
The same code is successfully working for iOS 13.
Code Block swift let s = NSMutableAttributedString( string: "hello world!", attributes: [.foregroundColor: UIColor.label] ) let range = s.mutableString.range(of: "world") s.replaceCharacters( in: range, with: NSAttributedString( string: "mars", attributes: [ .strikethroughStyle: NSUnderlineStyle.single.rawValue, .strikethroughColor: UIColor.systemRed, .foregroundColor: UIColor.systemRed, ] ) )
Here, I can see that the color of the substring "mars" is changed, but there is no strikethrough line.
The same code is successfully working for iOS 13.