xcode 如何将文件从一个项目导入到另一个项目

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34790142/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 08:25:38  来源:igfitidea点击:

How to Importing files from one project to another

xcodexcode7

提问by user2698307

I want to copy some files "Classes" from another project to my current project, but when I run it I get dozen of errors, its seem there are some steps to copying file from one project to another project using Xcode ,

我想将一些文件“类”从另一个项目复制到我当前的项目,但是当我运行它时,我遇到了很多错误,似乎有一些步骤可以使用 Xcode 将文件从一个项目复制到另一个项目,

I can make a collection of files "Classes" accessible in my project?

我可以在我的项目中访问一组文件“类”吗?

One project is Objective c, the another one seems to be Objective C++

一个项目是Objective c,另一个似乎是Objective C++

回答by Aamir

No there are not exactly steps we need to follow. Just make sure all dependenciesare fulfilled while importing classesfrom other project. Don't forget to click at checkbox Copy files if neededso that Xcodecan make separate copy for your project.
In order to import files in your project click following sequence:

不,没有我们需要遵循的确切步骤。从其他项目dependencies导入时classes,请确保所有内容均已完成。不要忘记单击复选框,Copy files if needed以便Xcode可以为您的项目制作单独的副本。
为了在您的项目中导入文件,请单击以下顺序:

command + option + A

命令 + 选项 + A

or you can also add files by

或者您也可以通过添加文件

Xcode -> File -> Add files to "Project Name"

Xcode -> 文件 -> 将文件添加到“项目名称”

回答by SwiftArchitect

Individual Files

个人档案

Organize your files

整理您的文件

Place the files you will need at a location that is accessible by the Xcode project. Usually, you place these files is a directory below your Xcode project, but that is absolutely not necessary.

将您需要的文件放在 Xcode 项目可访问的位置。通常,您将这些文件放在 Xcode 项目下面的目录中,但这绝对没有必要。

Drag & drop

拖放

Grab all the files you need and drop them onto your project organizer. You will be prompted with this dialog, to which the settings should look like this (ensure that your target is selected):

获取您需要的所有文件并将它们放到您的项目管理器上。您将收到此对话框的提示,其设置应如下所示(确保选择了您的目标)

enter image description here

在此处输入图片说明



Projects

项目

If you want to include a Cocoa Touch Static Library, in the form of an Xcode project, drag & drop will suffice.

如果你想包含一个 Cocoa Touch 静态库,以 Xcode 项目的形式,拖放就足够了。