[英]project workspace-how to import class from other projects ios
I have added two projects in xcode workspace., set scheme correctly.Is it possible to include or create subclasses of one project in other? 我在xcode工作区中添加了两个项目。正确设置方案。是否可以在另一个项目中包含或创建一个项目的子类? Like, I have a class
coreViewController.swift
which is subclass of UIViewController
in one project. 就像我有一个类
coreViewController.swift
,它是一个项目中UIViewController
子类。 I would like to create a class say, exampleViewController in second project which is a subclass of CoreViewController.swift
? 我想在第二个项目中创建一个类exampleViewController,它是
CoreViewController.swift
的子类?
Although I would not do it, it's possible. 尽管我不会这样做,但有可能。 Just chose File > add file and navigate to the class you want to add to your project.
只需选择“ 文件”>“添加文件” ,然后导航到要添加到项目中的类。 Deselect the copy option, done.
取消选择复制选项,完成。
But I would suggest to choose a different approach and remove the class(es) you use in both projects out of both into a separate repository (ie. a framework, git externals, ...) 但是我建议选择一种不同的方法,并将在两个项目中使用的类从这两个项目中删除到一个单独的存储库中(例如,框架,git externals等)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.