如何从游乐场初始化主故事板

时间:2019-01-13 10:13:03

标签: ios swift uiviewcontroller storyboard swift-playground

我正在使用以下简单代码在Playground内部初始化情节提要:

let storyboard = UIStoryboard(name: "Main", bundle: nil)
let controller = storyboard.instantiateViewController(withIdentifier:"ViewController")

PlaygroundPage.current.liveView = controller

ViewController是可可触摸框架中嵌入的一个公共类,因为我想与Playground共享此代码,但出现此错误:

enter image description here

如果我使用简单的UIViewController创建新的故事板,那么一切都正常。有什么想法吗?

1 个答案:

答案 0 :(得分:-1)

找到了必须为框架和项目的Main.storyboard设置目标成员身份的解决方案