在 Xcode 中,我如何创建一个新的工作区并向其中添加 1 个项目,以便我可以看到该项目及其文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38298219/
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-08 18:19:43  来源:igfitidea点击:

In Xcode how do I create a new workspace and add 1 project to it so that I can see the project and its files?

xcode

提问by Andrew Paul Simmons

In Xcode how do I create a new workspace and add 1 project to it so that I can see the project and its files?

在 Xcode 中,我如何创建一个新的工作区并向其中添加 1 个项目,以便我可以看到该项目及其文件?

If I just drag in the project, all I can see is the project it cannot be expanded, I cannot see the files. Also, is there anyway to copy over existing schemes from the project so that they can be used in the workspace?

如果我只是拖入项目,我只能看到它无法展开的项目,我看不到文件。另外,无论如何从项目中复制现有方案,以便它们可以在工作区中使用?

回答by Andrew Paul Simmons

First choose file > new > Workspace...

首先选择文件>新建>工作区...

Then, you must first, and this is important, you must first close the project that you want to drag in. Than drag in the .xcodeproj file from the finder to your new workspace.Then it will appear properly and expand to show all of its files and your schemes will be available.

然后,您必须首先,这很重要,您必须首先关闭要拖入的项目。然后将 .xcodeproj 文件从查找器拖到新工作区。然后它将正确显示并展开以显示其所有文件,您的方案将可用。

回答by Gene Loparco

Although the accepted answer is correct, there is an alternate way to accomplish the same thing, and it is arguably easier/more straightforward. You can just open up the project in Xcode and click File -> Save as Workspace...

尽管接受的答案是正确的,但有另一种方法可以完成相同的事情,并且可以说更容易/更直接。您可以在 Xcode 中打开项目并单击 File -> Save as Workspace...

Bam! You now have a workspace with 1 project in it, as requested.

砰!根据要求,您现在有一个包含 1 个项目的工作区。

回答by yoAlex5

As alternative

作为替代

- Close a project that you are going to add to a workspace
- Open Project Navigator -> Right click -> Add Files to "<workspace_name>"...

回答by Fattie

Just FYI, 2020, Apple recently added a thing,

仅供参考,2020 年,Apple 最近添加了一个东西,

  1. make your workspace, exit it and

  2. make your new project. in fact when you enter the name to save the project,

  1. 创建您的工作区,退出它并

  2. 制作你的新项目。事实上,当你输入名称来保存项目时,

they added this option:

他们添加了这个选项:

enter image description here

在此处输入图片说明

just select the workspace you wish to add it to.

只需选择您希望将其添加到的工作区。