简体   繁体   English

我们可以使用swift3.0将一个项目视图控制器类用于同一工作区中的另一个项目吗

[英]Can we use one project view controller class to another project in same workspace using swift3.0

I have created 3 different project and added in one workspace all three project has it own storyboard I have to use first project storyboard view controller in second project storyboard or vice versa. 我创建了3个不同的项目,并在一个工作区中添加了所有三个项目都有自己的情节提要,我必须在第二个项目情节提要中使用第一个项目情节提要视图控制器,反之亦然。 Is it possible?, How can I achieve this in swift 3.0? 有可能吗?如何在Swift 3.0中实现呢?

Make global variables like so: 使全局变量如下所示:

let firstStoryboard = UIStoryboard(name: "<First Storyboard name>", bundle: nil)
let secondStoryboard = UIStoryboard(name: "<Second Storyboard name>", bundle: nil)

in whichever file you need to access it. 无论您需要访问哪个文件。

This might work! 这可能有效!

You cannot create project which depend on each other like 您不能创建彼此依赖的项目

FrameworkA is linked with FrameworkB and FrameworkB is linked with FrameworkA . FrameworkA相链接FrameworkBFrameworkB相链接FrameworkA This setup create dependecy circle. 此设置创建了依赖圈。

You can create two frameworks but only one of them can know about other: 您可以创建两个框架,但其中只有一个可以了解其他框架:

FrameworkA is linked with FrameworkB but FrameworkB don't know any think about FrameworkA or vice versa. FrameworkAFrameworkB链接在一起,但是FrameworkB不了解FrameworkA ,反之亦然。

If you have setup like: 如果您有这样的设置:

- Application
| - FrameworkA
| - FrameworkB

you can use your ViewController in Application project and it is ok. 您可以在Application项目中使用ViewController,并且可以。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 swift3.0项目的任何标记中都不能包含.h文件 - swift3.0 project can't have .h file in any tags 从 Swift 3 中的另一个项目访问视图控制器 - Accessing View Controller from another project in Swift 3 将视图控制器从一个项目复制到另一个项目 - Copy view controller from one project to another 基于故事板的iOS项目中Swift类的弹出视图控制器 - Pop view controller from Swift class in storyboard based iOS project 如何在swift3.0中使用nonjson数据 - How to work with nonjson data in swift3.0 在另一个项目中使用一个项目的App委托/视图控制器 - Using App delegate / View Controllers of one project in another project 如何将字典从一个视图 controller class 传递到另一个视图?SWIFT - How can I pass dictionary from one view controller class to another?SWIFT 我们可以为一个View Controller使用两个不同的Xib吗? - Can we use Two different Xib's for one View Controller? 我如何使用swift在不是当前的视图控制器中显示从数据库中检索到的数据,而在ios中显示另一个 - how can i show retrieved data from database in not a present view controller but another one in ios with using swift Swift3.0:不能调用非功能类型的值&#39;((Selector!)-&gt; Bool)!&#39; - Swift3.0: Can not call value of non-functional type'((Selector!)->Bool)!'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM