On the CS193p course they says that in an init method there should be an if statement to check if the [super init]
works:
if (self = [super init]) {
self.someProperty = parameter;
}
return self;
I don't understand why this is done, as if the [super init]
returns nil, the method itself will also return nil, no matter the outcome of the if statement?
EDIT: The question is; why put self = [super init]
inside an if statement. (Not: Why have self = [super init]
at all)