NSParagraphStyle's +defaultParagraphStyle return type should be instancetype

Originator:oliver.drobnik
Number:rdar://16939304 Date Originated:16-May-2014 12:07 PM
Status:Open Resolved:
Product:iOS SDK Product Version:iOS 7.1.1 (11D201)
Classification:UI/Usability Reproducible:Always
 
Summary:
The method +[NSParagraphStyle defaultParagraphStyle] returns an NSParagraphStyle. It should return instancetype instead for consistence.

Steps to Reproduce:
Add this code to a new project: NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle defaultParagraphStyle];

Expected Results:
- to get an NSMutableParagraphStyle instance initialized with the default paragraph style.
- be able to change values to my liking

Actual Results:
- you get a compiler warning about incompatible pointer types
- an NSParagraphStyle is returned
- trying to assign a value to a property produces an exception

Notes:
This should work consistently with other classes where you have an immutable version and a mutable version being a subclass of it. e.g. NSArray and NSMutableArray. There you can use [NSArray array] and [NSMutableArray array] and get the correct class.

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!