Custom init for UIViewController in Swift with interface setup in storyboard

后端 未结 12 2137
长情又很酷
长情又很酷 2020-11-27 05:08

I\'m having issue for writing custom init for subclass of UIViewController, basically I want to pass the dependency through the init method for viewController rather than se

12条回答
  •  星月不相逢
    2020-11-27 05:33

    As of iOS 13 you can initialize the view controller that resides in a storyboard using: instantiateViewController(identifier:creator:) method on the UIStoryboard instance.

    tutorial: https://sarunw.com/posts/better-dependency-injection-for-storyboards-in-ios13/

提交回复
热议问题