In swift, we must confirm that the subclass has completed the initialization work before calling the parent class initializer, as follows:
class SubObject: CustomObject {
var dogName: String
override init() {
dogName = "大黄"
super.init()
}
}
In Object-c, we must first confirm that the parent class has completed initialization before initializing the subclass:
- (instancetype)init{
self = [super init];
if (self) {
}
return self;
}
Is this the reason?