For aesthetic reasons, I decided to change this:
if ((self = [super init])) {
// init self
}
return self;
In it:
if (!(self = [super init])) return nil;
// init self
return self;
In theory, they do the same. The first is the classic way, it just works. After debugging the second, I found that it almost worked. "If" does this correctly, the initialization code also, but after returning "I" the debugger returns to "if" and returns nil!
All the classes that I did with the second one, I come back to use the "right" way, because they are where initing is with nil, but I really want to know why it behaves like this! I am afraid that this may be the result of something else!
source
share