UISegmentControl titleTextAttributes types do not match best practice

Originator:brianaking
Number:rdar://27580020 Date Originated:27-Jul-2016 08:21 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode
Classification:UI/Usability Reproducible:Sometimes
 
Summary:
The majority of UIKit API’s dealing with attributes for NSAttributedString use [String: AnyObject]. UISegmentControl uses [NSObject: AnyObject]. This forces a bunch of unfortunate casting

    @available(iOS 5.0, *)
    public func setTitleTextAttributes(attributes: [NSObject : AnyObject]?, forState state: UIControlState)
    @available(iOS 5.0, *)
    public func titleTextAttributesForState(state: UIControlState) -> [NSObject : AnyObject]?

Steps to Reproduce:


Expected Results:
Describe what you expected to happen when you executed the steps above.

Actual Results:
Explain what actually occurred when steps above were executed.

Regression:
Describe circumstances where the problem occurs or does not occur, such as software versions and/or hardware configurations.

Notes:
Provide additional information, such as references to related problems, workarounds and relevant attachments.

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!