.playground 是一个 swift 文件吗?谁能“看到"它? [英] Is .playground a swift file? Who can 'see' it?

查看:23
本文介绍了.playground 是一个 swift 文件吗?谁能“看到"它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想弄清楚 .playground 文件到底是什么.如果是源文件,项目中的其他 swift 文件或其他 .playground 文件都无法(据我尝试)看到它,反之亦然.

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.

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

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

我知道它(.playground 文件)的作用,我只是不知道它如何适合项目.

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

推荐答案

.playground 文件实际上是一个包目录,可以通过右键单击它并选择显示包内容"来验证.

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

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

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.

您还可以向其中添加文件,例如要在 Playground 中使用的图像和其他资源.

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.

这篇关于.playground 是一个 swift 文件吗?谁能“看到"它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆