Under the section “Drawing Text Die Faces” an NSMutableParagraphStyle is created as follows:

Why isn’t it possible to create an NSMutableParagraphStyle like this?:

var paraStyle = NSMutableParagraphStyle.defaultParagraphStyle() //or NSMutableParagraphStyle.defaultMutableParagraphStyle

I know it is possible, but then it’s not possible to set the NSTextAlignment because defaultParagraphStyle returns an NSParagraphStyle and not NSMutableParagraphStyle. Why isn’t it some easier way to instantiate an NSMutableParagraphStyle object?? It just seems so counterintuitive.

I’m guessing that’s a way to make sure that an NSMutableParagraphStyle object gets initialized properly with the default values. Why doesn’t the NSMutableParagraphStyle class just use a copy of the initializer for the NSMutableParagraph class? Possibly because the designers of the NSParagraphStyle class want to eliminate the number of places they have to change the code if they decide to change the default values.

Then again, with other child classes we call super.init() in the child class initializers to make sure the instances get initialized properly by their parent classes. So, the class designers did not want us to be able to call init() in the NSMutableParagraphStyle class, which means they didn’t want us to be able to add properties to the NSParagraphStyle instances.