获取操场以显示所有循环结果

时间:2022-09-22 15:50:56

I'm using an xcode 7 playground, and I want to know how to make the playground display all the results printed out by a loop.

我正在使用xcode 7游乐场,我想知道如何让游乐场显示循环打印出的所有结果。

for example:

例如:

获取操场以显示所有循环结果

This will tell me the loop ran 4 times, but it will only display the last value of the iteration. Is there a way I can make it show all values?

这将告诉我循环运行4次,但它只显示迭代的最后一个值。有没有办法让它显示所有价值观?

4 个解决方案

#1


30  

Right click on the inline quick look (the gray rounded rectangle with "4" in it). There's an option to show all the results in a list:

右键单击内联快速查看(灰色圆角矩形,其中带有“4”)。可以选择在列表中显示所有结果:

获取操场以显示所有循环结果

You can also show everything that's been printed to the console for the entire playground execution by clicking the show debug area button all the way in the bottom left corner:

您还可以通过单击左下角的show debug area按钮显示已打印到控制台的所有操作,以便执行整个游乐场:

获取操场以显示所有循环结果

#2


3  

In xcode 7, right clicking with a mouse on the display box will give you the correct dropdown menu. However, Ctrl-clicking with the track pad on a macbook will not give the correct dropdown menu. You have to select it under the Editor menu.

在xcode 7中,右键单击显示框上的鼠标将为您提供正确的下拉菜单。但是,使用macbook上的触控板按住Ctrl键并不会给出正确的下拉菜单。您必须在“编辑器”菜单下选择它。

This bug goes away in xcode 7.1

这个bug在xcode 7.1中消失了

获取操场以显示所有循环结果

#3


2  

I attach GIF image for showing executing result of playground code. 获取操场以显示所有循环结果

我附上GIF图像以显示游乐场代码的执行结果。

#4


0  

You can see the results directly on the Debug Area

您可以直接在Debug Area上查看结果

获取操场以显示所有循环结果

(or)

(要么)

click anywhere on the line where your print method is defined and follow the below steps

单击定义打印方法的行上的任意位置,然后按照以下步骤操作

 1. Editor -> Show Results for Current Line Editor
 2. Editor -> Result Display Mode -> Value History

Vice versa, you can hide the print details by

反之亦然,您可以隐藏打印细节

 Editor -> Hide Results for Current Line

获取操场以显示所有循环结果

#1


30  

Right click on the inline quick look (the gray rounded rectangle with "4" in it). There's an option to show all the results in a list:

右键单击内联快速查看(灰色圆角矩形,其中带有“4”)。可以选择在列表中显示所有结果:

获取操场以显示所有循环结果

You can also show everything that's been printed to the console for the entire playground execution by clicking the show debug area button all the way in the bottom left corner:

您还可以通过单击左下角的show debug area按钮显示已打印到控制台的所有操作,以便执行整个游乐场:

获取操场以显示所有循环结果

#2


3  

In xcode 7, right clicking with a mouse on the display box will give you the correct dropdown menu. However, Ctrl-clicking with the track pad on a macbook will not give the correct dropdown menu. You have to select it under the Editor menu.

在xcode 7中,右键单击显示框上的鼠标将为您提供正确的下拉菜单。但是,使用macbook上的触控板按住Ctrl键并不会给出正确的下拉菜单。您必须在“编辑器”菜单下选择它。

This bug goes away in xcode 7.1

这个bug在xcode 7.1中消失了

获取操场以显示所有循环结果

#3


2  

I attach GIF image for showing executing result of playground code. 获取操场以显示所有循环结果

我附上GIF图像以显示游乐场代码的执行结果。

#4


0  

You can see the results directly on the Debug Area

您可以直接在Debug Area上查看结果

获取操场以显示所有循环结果

(or)

(要么)

click anywhere on the line where your print method is defined and follow the below steps

单击定义打印方法的行上的任意位置,然后按照以下步骤操作

 1. Editor -> Show Results for Current Line Editor
 2. Editor -> Result Display Mode -> Value History

Vice versa, you can hide the print details by

反之亦然,您可以隐藏打印细节

 Editor -> Hide Results for Current Line

获取操场以显示所有循环结果