Get playground to display all loop results

2019-03-12 09:57发布

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.

for example:

enter image description here

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条回答
Root(大扎)
2楼-- · 2019-03-12 10:37

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:

Value History

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:

enter image description here

查看更多
太酷不给撩
3楼-- · 2019-03-12 10:51

You can see the results directly on the Debug Area

enter image description here

(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

enter image description here

查看更多
太酷不给撩
4楼-- · 2019-03-12 10:57

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.

This bug goes away in xcode 7.1

enter image description here

查看更多
做个烂人
5楼-- · 2019-03-12 11:00

I attach GIF image for showing executing result of playground code. GIF Animation

查看更多
登录 后发表回答