NSStrikethroughStyleAttributeName is not rendered if applied to a sub range of NSMutableAttributedString length

Originator:stefano.piamonti
Number:rdar://31034683 Date Originated:14-Mar-2017
Status:Open Resolved:
Product:iOS Product Version:10.3 beta 2 - 10.3 beta 5
Classification:UI/Usability Reproducible:Always
 
Area:
Foundation

Summary:
A strikethrough (single, double, ...) added as attribute to an instance of NSMutableAttributedString is not rendered if the apply range is not the whole string range. This happens using addAttribute(_ name: String, value: Any, range: NSRange),  insert(_ attrString: NSAttributedString, at loc: Int), append(_ attrString: NSAttributedString),, ...

Steps to Reproduce:
1. Create a NSMutableAttributedString
2. Add some text to it
3. Apply the strikethrough using NSMutableAttributedString attribute to a subrange of the string
4. Add the string to an UILabel

Expected Results:
The substring in the subrange targeted is rendered marked with a strikethrough

Actual Results:
The whole string is rendered without strikethrough

Version:
from 10.3 beta 2 to 10.3 beta 5

Notes:
It's rendered properly with Xcode until 8.2 and on iOS devices with 10.2.x and previous version of iOS

Configuration:
iPhone 5S, iPhone 7+, iPad Air, Xcode playground Version 8.3 beta 4 (8W143q)

Playground (please use Xcode 8.3 beta):
https://cl.ly/2Q0S3v3i0d2c

Comments

Added workaround

Workaround for specific scenarios can be found here: http://stackoverflow.com/questions/43074652/ios-10-3-nsstrikethroughstyleattributename-is-not-rendered-if-applied-to-a-sub

By roman.shevtsov at March 28, 2017, 4:12 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!