如何防止Xcode 7游乐场自动运行?

时间:2023-01-23 21:18:45

I'm working on an Xcode 7 Playground that has many things running at once. Whenever I make an edit, it refreshes, restarts what was running and runs through the entire code again. That crashes my playground around every 15 minutes. Is there a way to prevent playgrounds from automatically running whenever I make an edit?

我正在一个Xcode 7游乐场工作,里面有很多东西同时运行。每当我进行编辑时,它会刷新、重新启动正在运行的内容并再次遍历整个代码。我的操场每15分钟就会撞一次。有什么方法可以防止我编辑时操场自动运行吗?

2 个解决方案

#1


89  

In the lower-left part of the Playground there's a right-facing blue arrow, looking like a "play" button.

在操场的左下角有一个面向右的蓝色箭头,看起来像一个“play”按钮。

Do a long click on this button and you will get two options: "Automatically Run" and "Manually Run".

点击这个按钮,你会得到两个选项:“自动运行”和“手动运行”。

Choose the latter to put the Playground is manual mode and start/stop its execution yourself by clicking on this button.

选择后者放置游乐场是手动模式,并通过点击这个按钮自己开始/停止它的执行。

如何防止Xcode 7游乐场自动运行?


You can also trigger the code execution by making a custom shortcut to the "Execute Playground" Editor menu command.

您还可以通过创建“执行游乐场”编辑器菜单命令的自定义快捷方式来触发代码执行。

Go to Xcode > Preferences... then go to Key Bindings, scroll down to Editor Menu for Playground and add a new shortcut of your choice by double-clicking in the right column in front of the Execute Playground command.

转到Xcode >首选项…然后转到Key Bindings,向下滚动到游乐场的编辑器菜单,并通过在执行游乐场命令前面的右列双击添加您所选择的新快捷方式。

如何防止Xcode 7游乐场自动运行?

#2


5  

Actually, you CAN map a shortcut for "Execute Playground" to Cmd+R.

实际上,您可以将“执行游乐场”的快捷方式映射到Cmd+R。

Use macOS keyboard shortcuts, instead of Xcode's keybindings.

使用macOS键盘快捷键,而不是Xcode的键绑定。

Go to System Preferences > Keyboard > Shortcuts,

切换到系统偏好>键盘>快捷键,

and in App shortcuts, click on +.

在App快捷方式中,点击+。

Choose Xcode.app, and add a new shortcut for "Execute Playground" (you have to type precisely this!). 如何防止Xcode 7游乐场自动运行?

选择Xcode。应用程序,并为“执行游乐场”添加一个新的快捷方式(你必须精确地键入这个!)

Then click on Add. 如何防止Xcode 7游乐场自动运行?

然后点击添加。

Now you can use this shortcut in Xcode. 如何防止Xcode 7游乐场自动运行?

现在可以在Xcode中使用这个快捷方式。

And don't worry for conflicts (at least up to Xcode 9): Execute Playground is not available for standard Xcode projects, and Run is not active for Playgrounds.

不要担心冲突(至少在Xcode 9之前):对于标准的Xcode项目,执行游乐场是不可用的,在操场上运行也不活跃。

#1


89  

In the lower-left part of the Playground there's a right-facing blue arrow, looking like a "play" button.

在操场的左下角有一个面向右的蓝色箭头,看起来像一个“play”按钮。

Do a long click on this button and you will get two options: "Automatically Run" and "Manually Run".

点击这个按钮,你会得到两个选项:“自动运行”和“手动运行”。

Choose the latter to put the Playground is manual mode and start/stop its execution yourself by clicking on this button.

选择后者放置游乐场是手动模式,并通过点击这个按钮自己开始/停止它的执行。

如何防止Xcode 7游乐场自动运行?


You can also trigger the code execution by making a custom shortcut to the "Execute Playground" Editor menu command.

您还可以通过创建“执行游乐场”编辑器菜单命令的自定义快捷方式来触发代码执行。

Go to Xcode > Preferences... then go to Key Bindings, scroll down to Editor Menu for Playground and add a new shortcut of your choice by double-clicking in the right column in front of the Execute Playground command.

转到Xcode >首选项…然后转到Key Bindings,向下滚动到游乐场的编辑器菜单,并通过在执行游乐场命令前面的右列双击添加您所选择的新快捷方式。

如何防止Xcode 7游乐场自动运行?

#2


5  

Actually, you CAN map a shortcut for "Execute Playground" to Cmd+R.

实际上,您可以将“执行游乐场”的快捷方式映射到Cmd+R。

Use macOS keyboard shortcuts, instead of Xcode's keybindings.

使用macOS键盘快捷键,而不是Xcode的键绑定。

Go to System Preferences > Keyboard > Shortcuts,

切换到系统偏好>键盘>快捷键,

and in App shortcuts, click on +.

在App快捷方式中,点击+。

Choose Xcode.app, and add a new shortcut for "Execute Playground" (you have to type precisely this!). 如何防止Xcode 7游乐场自动运行?

选择Xcode。应用程序,并为“执行游乐场”添加一个新的快捷方式(你必须精确地键入这个!)

Then click on Add. 如何防止Xcode 7游乐场自动运行?

然后点击添加。

Now you can use this shortcut in Xcode. 如何防止Xcode 7游乐场自动运行?

现在可以在Xcode中使用这个快捷方式。

And don't worry for conflicts (at least up to Xcode 9): Execute Playground is not available for standard Xcode projects, and Run is not active for Playgrounds.

不要担心冲突(至少在Xcode 9之前):对于标准的Xcode项目,执行游乐场是不可用的,在操场上运行也不活跃。