Create A UIViewController Extended Class With A Custom Initializer

爷,独闯天下 提交于 2020-01-04 03:57:25

问题


I love Swift, except for this

 required init(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

If I create any UIViewController extended class I have to have this ugly, unclear, required init, as the init I don't want.

Is there a way I can set up my code so I can have code setup so I can have my own required init, and then it just calls this at the end? I don't want my client code to have to deal with this, and I'd like to have one clear init() call, instead of a 'initWithSomeCumbersomeName()' call.

If anyone has a clean workaround to this I am all ears!

来源:https://stackoverflow.com/questions/26394009/create-a-uiviewcontroller-extended-class-with-a-custom-initializer

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