In Microsoft's WinObjC UIApplication.mm file (at https://github.com/Microsoft/WinObjC/blob/master/Frameworks/UIKit/UIApplication.mm) the init
method is implemented for both UIApplication
and WOCDisplayMode
.
Neither class' init
method calls [super init]
, or any method from that family of methods that would eventually result in a call to [super init]
. I've never seen this before, apart from the initialization of NSProxy
objects.
I've reproduced the implementation as of this writing of WOCDisplayMode
below for reference.
-(instancetype) init
{
_fixedWidth = 320.0f;
_fixedHeight = 480.0f;
_fixedAspectRatio = 0.0f;
_magnification = 1.0f;
_autoMagnification = TRUE;
_sizeUIWindowToFit = TRUE;
_operationMode = WOCOperationModePhone;
return self;
}
It seems to me that this could create a number of problems; for example, if one of the superclasses of UIApplication
, like UIResponder
, at some point overrode init
itself, and set up internal state that future method calls depended on.
Why might the implementor have elected not to call [super init]
? Is this ever a justifiable decision? Is it ever the correct one?