The most βmodernβ approach (used by default in Xcode 4).
- (instancetype)init { self = [super init]; if (self) { // Initialization code here. } return self; }
The default value in older versions of Xcode.
- (instancetype)init { if (self = [super init]) { // Initialization code here. } return self; }
While "legal" it is very rarely seen, and I would not recommend it.
Traditionally, in Objective-C 1.0, init methods returned an id , and from later iterations of Objective-C 2.0, it is recommended that you return instancetype instead.
Atlas source share