操场是一个快速的档案吗?谁能“看到”吗?

时间:2023-01-23 18:06:33

I'm trying to figure out what .playground file really is. If it's a source file, it cannot (as far as I've tried) be seen by other swift files in the project, nor other .playground files or vice versa.

我想弄明白,操场档案到底是什么。如果它是一个源文件,它不能(在我尝试的范围内)被其他的swift文件所看到,或者其他的。操场文件,反之亦然。

Is a project supposed to have one such file? Are they a kind of swift file?

一个项目应该有一个这样的文件吗?它们是一种swift文件吗?

I know what it (.playground file) does, I just can't figure out how it fits in the project.

我知道那是什么。(操场档案)做的,我只是不知道它如何适合这个项目。

3 个解决方案

#1


7  

A .playground file is actually a bundle directory, which can be verified by right clicking it and selecting "Show Package Contents".

操场文件实际上是一个bundle目录,可以通过右键单击并选择“Show Package Contents”来验证。

It includes a .swift file for the actual source code, which can be edited normally , as well as a .xcplayground file and a .xctimeline file, which are opaque and can't be edited through normal means.

它包括一个用于实际源代码的.swift文件,它可以正常编辑,以及一个.xcplay文件和.xctimeline文件,它是不透明的,不能通过正常的方式进行编辑。

You can also add files to it, such as images and other resources to use inside your playground.

您还可以向它添加文件,比如在您的操场上使用的图像和其他资源。

It's not necessary to be present in application projects. It's used solely as a place to explore, without the need to create a project.

在应用程序项目中没有必要存在。它仅仅被用作一个探索的地方,而不需要创建一个项目。

#2


1  

My understanding is that it's purely abstract. It's a place to go and test out new apis/logic before you integrate it into your project. It's not meant to be part of your app.

我的理解是这纯粹是抽象的。在将新api /逻辑集成到项目之前,它是一个测试新api /逻辑的地方。它不是你的应用程序的一部分。

#3


0  

It is not a file. It is a bundle - directory.

它不是一个文件。它是一个包目录。

It contains:

它包含:

  • timeline.xctimeline
  • timeline.xctimeline
  • section-1.swif
  • - 1. - swif部分
  • contents.xcplayground
  • contents.xcplayground

#1


7  

A .playground file is actually a bundle directory, which can be verified by right clicking it and selecting "Show Package Contents".

操场文件实际上是一个bundle目录,可以通过右键单击并选择“Show Package Contents”来验证。

It includes a .swift file for the actual source code, which can be edited normally , as well as a .xcplayground file and a .xctimeline file, which are opaque and can't be edited through normal means.

它包括一个用于实际源代码的.swift文件,它可以正常编辑,以及一个.xcplay文件和.xctimeline文件,它是不透明的,不能通过正常的方式进行编辑。

You can also add files to it, such as images and other resources to use inside your playground.

您还可以向它添加文件,比如在您的操场上使用的图像和其他资源。

It's not necessary to be present in application projects. It's used solely as a place to explore, without the need to create a project.

在应用程序项目中没有必要存在。它仅仅被用作一个探索的地方,而不需要创建一个项目。

#2


1  

My understanding is that it's purely abstract. It's a place to go and test out new apis/logic before you integrate it into your project. It's not meant to be part of your app.

我的理解是这纯粹是抽象的。在将新api /逻辑集成到项目之前,它是一个测试新api /逻辑的地方。它不是你的应用程序的一部分。

#3


0  

It is not a file. It is a bundle - directory.

它不是一个文件。它是一个包目录。

It contains:

它包含:

  • timeline.xctimeline
  • timeline.xctimeline
  • section-1.swif
  • - 1. - swif部分
  • contents.xcplayground
  • contents.xcplayground