Xcode 6 - 防止快速的操场刷新
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25949171/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode 6 - Prevent swift playground refresh
提问by Alex
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.
每次 Playground 想要刷新结果时,它都必须运行那段代码(这需要一段时间才能运行),这使得 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 说:“现在不要运行我的游乐场。我会在它准备好时告诉你。”?
回答by R. Gordon
回答by Jason Rybka
I don't know an official way to do this but... If you leave a multiline comment at the bottom of the playground and do not add the closing */ tag it will not run until the closing tag is added.
我不知道这样做的官方方法,但是...如果您在操场底部留下多行注释并且不添加结束 */ 标记,则在添加结束标记之前它不会运行。