Check designated initializer in xcode

若如初见. 提交于 2020-01-17 06:01:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!