问题
Is there any way to find out which initializer is the designated one in super class in Xcode?
I type super().init.. then, Xcode shows all initializers of superclass. I want to know is there any sign or symbol to point out which is the designated one?
Also a quick question. A designated initializer(DI) in subclass is allowed to only call a convenience initializer(CI) in superclass since the CI in superclass will eventually call the DI in superclass. Correct me if I'm wrong, thanks.
回答1:
In Swift, any initializer not marked with the keyword "convenience" is a designated initializer.
And designated initializers are required to call a designated initializer in their immediate superclass, per The Swift Programming Language. They cannot call a convenience initializer.
来源:https://stackoverflow.com/questions/34376366/check-designated-initializer-in-xcode