Is .playground a swift file? Who can 'see' it?

送分小仙女□ 提交于 2020-02-21 11:18:53

问题


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?

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


回答1:


A .playground file is actually a bundle directory, which can be verified by right clicking it and selecting "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.

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:


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.




回答3:


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

It contains:

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


来源:https://stackoverflow.com/questions/24016561/is-playground-a-swift-file-who-can-see-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!