简体   繁体   English

Xcode 6 - 防止快速游乐场刷新

[英]Xcode 6 - Prevent swift playground refresh

Sometimes I'm writing some code on a playground that takes a while to complete. 有时我在操场上写一些代码需要一段时间才能完成。 For example: 例如:

var values = [[Int]](count: 10000, repeatedValue: [Int](count: 73, repeatedValue: 0))

And everytime the playground wants to refresh the results, it has to run that piece of code (that takes a while to run) and it makes Xcode as a whole very sluggish. 每当游乐场想要刷新结果时,它必须运行那段代码(这需要一段时间才能运行)并且它使整个Xcode非常缓慢。

I still want to be writing my code on a playground since it has some very nice features for testing your algorithms. 我仍然想在操场上编写我的代码,因为它有一些非常好的功能来测试你的算法。 However, I'm finding that I have to comment certain lines of code just to continue writing without interruptions. 但是,我发现我必须对某些代码行进行注释才能继续编写而不会中断。

Is there any way to say to Xcode: "Do not run my playground right now. I'll tell you when it's ready."? 有没有办法对Xcode说:“现在不要跑我的操场。我会告诉你什么时候准备好了。”?

In Xcode 7, you can choose between automatic or manual execution of a playground by clicking and holding the ► arrow at the bottom left part of the playground. 在Xcode 7中,您可以通过单击并按住操场左下角的►箭头来选择自动或手动执行游乐场。 截图

Documentation link 文档链接

我不知道这样做的正式方法,但是......如果你在游乐场的底部留下多行评论并且不添加结束* /标记,那么在添加结束标记之前它不会运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM