在应用程序中嵌入Xcode游乐场

时间:2023-01-23 17:52:50

I want to make a Cocoa OS X application where users will be able to input and execute Swift language code within a window in my application. My first thought was to make my own basic IDE, and execute compilation and executing with system calls; however, I'd really like to have the interactive Playground feature.

我想做一个Cocoa OS X应用程序,用户可以在我的应用程序的窗口内输入和执行Swift语言代码。我的第一个想法是制作自己的基本IDE,并使用系统调用执行编译和执行;然而,我真的很想拥有互动游乐场功能。

I did my research and found that I can create Xcode Playground files with embedded documentation, but this raises a question:

我做了研究,发现我可以用嵌入式文档创建Xcode游乐场文件,但这提出了一个问题:

Does the documentation have to be placed above and below the playground, or can I embed a Playground within a container in my HTML code?

文档必须放在游乐场的上面和下面,还是可以在HTML代码的容器中嵌入游乐场?

The Xcode Playground embedded documentation I speak of can be found here.

我所说的Xcode游乐场嵌入式文档可以在这里找到。

Basically, I am looking to embed the Playground in a way that mimics the layout used on CodeAcademy.com

基本上,我正在寻找一种模仿CodeAcademy.com上使用的布局来嵌入运动场

在应用程序中嵌入Xcode游乐场

Is this possible with the Documentation embedded Xcode Playgrounds, or must I recreate an IDE from scratch within my Cocoa application?

这是否可以通过嵌入Xcode的文档实现,还是必须在Cocoa应用程序中从头重新创建IDE ?

1 个解决方案

#1


2  

According to Apple's Interactive Learning Document Format Reference, the sections element of a playground can contain only a flat list of code and documentation elements interspersed, which is to say they must be inline as of writing.

根据苹果的交互式学习文档格式参考,游乐场的section元素只能包含一个穿插的代码和文档元素的平面列表,也就是说,在编写时它们必须是内联的。

However, you'll notice a message that the top of the guide,

但是,你会注意到在指南的顶部,

Warning: This is a specification that is likely to change.

警告:这是一个可能会改变的规范。

Conclusion: no, but file a feature request.

结论:没有,但提出一个功能请求。

#1


2  

According to Apple's Interactive Learning Document Format Reference, the sections element of a playground can contain only a flat list of code and documentation elements interspersed, which is to say they must be inline as of writing.

根据苹果的交互式学习文档格式参考,游乐场的section元素只能包含一个穿插的代码和文档元素的平面列表,也就是说,在编写时它们必须是内联的。

However, you'll notice a message that the top of the guide,

但是,你会注意到在指南的顶部,

Warning: This is a specification that is likely to change.

警告:这是一个可能会改变的规范。

Conclusion: no, but file a feature request.

结论:没有,但提出一个功能请求。