class MyCViewContollerClass:UIViewController{
var button = UIButton()
}
let storyBoard = UIStoryboard()
let viewController = storyBoard.instantiateViewController(withIdentifier: "vc") as! MyCViewContollerClass
答案 0 :(得分:1)
您需要从文件中加载故事板:
let storyboard = UIStoryboard(name: "MyStoryboardName", bundle: nil)
或者,如果您没有故事板,则可以通过编程方式创建视图控制器:
let viewController = MyCViewControllerClass()