在工作区中打开另一个项目的故事板

Open storyboard of another project in workspace

有没有办法在同一个工作空间中实例化另一个项目的故事板? 通过使用不同的故事板名称并指向其包。

当然,您可以在同一工作区中从一个项目打开另一个项目的故事板。

比如说,您在框架中有一个情节提要,并且想在您的应用程序中使用它。以下是您如何从您的应用程序代码中做到这一点,

let frameworkBundle = NSBundle(identifier: "com.yourdomain.nameOfFramework") //getting the bundle for the framework
let storyboardFramework = UIStoryboard(name: "SM_Main", bundle: frameworkBundle) //pulling the storyboard from the framework

对我的项目成功的解决方案。 Main.storyboard 引用了另一个工作区项目中的视图控制器。

我的工作区有 2 个项目:

  1. MainProjectMain.storyboard
  2. 测试项目Test.storyboard 和捆绑标识符 = com.testbundleid

如何连接它们?

Main.storyboard 中创建 故事板参考 属性:

  • 故事板 = Test ;
  • 捆绑包 = com.testbundleid
  • 故事板 ID = TestViewController