如何在Swift Playground书中展示游戏机?
我正在用Xcode创建一本Swift游乐场书籍,使用。
现在,我希望我的学生可以使用这本操场书的书有一个控制台,以便他们可以使用 print
语句进行调试。
在Apple提供的游乐场书籍中,通常有一个按钮可以在右角处打开控制台:
<< img src =“ https://i.sstatic.net/oxhfm.jpg” alt =“ Apple Playground屏幕截图”>
但是,当我使用Swift Playgrounds打开自己的游乐场书籍时,没有控制台按钮:
< a href =“ https://i.sstatic.net/eufgi.png” rel =“ nofollow noreferrer”>
我如何在操场书中获得游戏机?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
终于找到了解决方案。
您必须在操场书的
subtest.plist.plist
文件中设置版本
键为版本8.0
(我猜)。或直接编辑文件的源代码:
没有明显原因,Apple此时不提供最新稳定Xcode版本(13.4)的Swift Playgrounds作者模板(这在当您必须下载匹配的Swift工具链以构建该模板时本身,因此我使用的是最新的模板,而是用于Xcode 13.2的最新模板。该模板的
版本
将设置为7.0
,似乎此游乐场版本尚不支持控制台。Finally found the solution.
You have to set the
Version
key in the Playground Book'sManifest.plist
file to version8.0
(or above I guess).or when editing the file's source code directly:
For no apparent reason, Apple doesn't provide a Swift Playgrounds Author Template for the latest stable Xcode version (13.4) at this time (which is trouble in itself as you have to download the matching Swift toolchain to even build that template), so I used the newest template available instead which is for Xcode 13.2. This template has the
Version
set to7.0
and it seems like this Playground version does not support the console yet.