NSByteCountFormatter add unitsStyle to make VoiceOver labels easier to build

Originator:gspiers
Number:rdar://33143169 Date Originated:05/07/2017
Status:Open Resolved:
Product:iOS Foundation Product Version:10.3
Classification:Bug Reproducible:Always
 
Area:
Foundation

Summary:
It would be nice if NSByteCountFormatter had a way of configuring the unitsStyle, similar to NSDateComponentsFormatter which has unitsStyle.

If that was possible then I could use NSByteCountFormatter to produce the accessibilityLabel text for a label that formats bytes. In our app we put the download size in parenthesis which seems to cause a problem for VoiceOver. For example the label with text "Download (5.37 GB)" is read by VoiceOver as "Download 5.37 GEEBEE" instead of the expected "Download 5.37 gigabytes".

It's not too difficult to work around this, it seems if the byte string is on it's own without the parenthesis then VoiceOver will read the units in full, but having the unitsStyle would be clearer and more deliberate.

It would also be nice to pick the longer format in certain cases in our UI "5.12 Gigabytes" which currently isn't possible.

Steps to Reproduce:
Run sample project with VoiceOver on.

Expected Results:
Labels should be read correctly in all cases.

Observed Results:
Punctuation and parenthesis cause VoiceOver to read a string produced with NSByteCountFormatter incorrectly.

Version:
10.3.2

Sample project:
https://github.com/gspiers/radar_33143169

Comments


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!