How to manually invoke Playground's xcpcapturevalue to showcase Swift process data

Source: Internet
Author: User

Playground can display the results of the program in real time, sometimes we use loops or nesting, iterations, then the display of data may have to be batch and contrast, so as to see the results, sometimes we can directly from the image of a glance to know the program is right. Playground supports custom data capture and presentation. You can make comparisons between these graphs, one of which is the Xcpcapturevalue function.

This is the function: Func xcpcapturevalue<t> (identifier:string, value:t), manually capturing historical data, identifier is the name of the title of the chart displayed on the right side of the screen, Value is any data that needs to be captured, because it is possible to capture data in a loop to show the process of data change.

That is, each set of captured data forms a chart, and then the change can be shown in the next loop or next iteration. You can redraw this state diagram each time you change the identifier of the loop. The following is illustrated using an exchange-sorting algorithm, noting the use of Xcpcapturevalue in the program.

Create the playground file in Xcode6 Beta, copy the code from the background of the article to the playground, show the following interface, there are some running results displayed on the right side of the form:

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/extra/

Click the + sign in the lower right corner of the screen to show the chart interface, as shown below. Xcpcapturevalue Advantage is that it is easy to learn and compare, can be a number of algorithms to demonstrate the image.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.