Why is it not valid (well I guess it's not "invalid" because it generates a warning not an error...) to call a convenience initializer on super from within the designated initializer of a subclass? Super's convenience initializer should be able to do normal set up. Why would I want to do this instead of just calling the designated initializer on super? Take this example.
-I have a NSWindowController subclass (with a nib). DisplayImagesWindowController, let's say.
-The NSWindowController subclass needs images to display. So our designated iniitializer will be:
-(instancetype)initWithImages:(NSArray<NSImages*>*)images NS_DESIGNATED_INITIALIZER;
Now, since I'm using a nib...and it is required to use this nib for this class, the implementation of initWithImages: is like this:
-(instancetype)initWithImages:(NSArray<NSImages*>*)images
{
self = [super initWithWindowNibName:@"DisplayImagesWindowController"]; //<--Call a convenience initializer.
if (self)
{
_images = images;
}
return self;
}
Far as I know, there is nothing wrong or invalid about how this window controller will be set up...but the compiler warns to use one of the designated initializers instead. It seems a little crazy for me to use initWithWindow: and do the nib loading myself?