UIFontSymbolicTrait has incorrect type

Originator:douglashill
Number:rdar://34997559 Date Originated:15-Oct-2017 12:49 pm
Status:Open Resolved:
Product:iOS + SDK Product Version:Xcode 9.0 (9A235)
Classification:Other Bug Reproducible:Always
 
Summary:
In UIFontDescriptor.h, UIFontSymbolicTrait has type UIFontDescriptorAttributeName but should be UIFontDescriptorTraitKey.

This is a key to be used in the traits dictionary where the corresponding value is an NSNumber wrapping UIFontDescriptorSymbolicTraits. This dictionary is then set in the font descriptor’s attributes under the UIFontDescriptorTraitsAttribute key.

AppKit does this correctly in NSFontDescriptor.h: NSFontSymbolicTrait has type NSFontDescriptorTraitKey.

Steps to Reproduce:
Open UIFontDescriptor.h

Expected Results:
UIFontSymbolicTrait to have type UIFontDescriptorTraitKey

Actual Results:
UIFontSymbolicTrait has type UIFontDescriptorAttributeName

Version:
Xcode 9.0 (9A235)

Notes:
Swift workaround is to use

UIFontDescriptor.TraitKey(rawValue: UIFontDescriptor.AttributeName.symbolic.rawValue)

or just type stuff as Any.

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!