Spy on Swift programming and play on the playground

Source: Internet
Author: User

Since Apple released Swift, there is something new on Xcode---"Playground". Playground is like a playground where we can play in the world of code, and in this blog we'll show you how to use playground to quickly get started with swift programming. Playground in learning Swift language does play an important role, or that sentence, salted eggs here, the following cut into today's topic, how to create a playground, and how to use playground.

One. Create your own playground

Or use the previous Swiftdemo demo to create a playground that belongs to you.

1. Under the appropriate folder, right-click, select New File ..... As shown in the following:

          

2. After the first step you will see the following interface, we select Playground under source in iOS, and then click Next

          

3. Type the name of the playground you created, as shown below

          

  

4. Create a good playground as shown below

        

  Second, play in the playground

1.Playground is what you see, that is, the code that you write on the left, you immediately see the result of the line running on the right, as shown below, a loop of 5 cycles is written, and the right side of the loop is immediately for-in: 5 times

        

2. You can click on the small white point behind the 5 times to view the loop in more detail, as shown in the click on the white point back to appear after the loop after the operation of the output on the console, and then every time the change in the index value of the loop, is not feel special like it.

        

Iii. Summary

Today's blog shows how to create a playground file in your project and how to use it to spy on the Swift language, and the next blog will use playground as a guide for more detailed snooping. Swift language more details, if for iOS development problems can be in the following message to Exchange learning, or join the QQ Exchange group above, common progress and improve. Look forward to some of the following swift tutorials, and finally to thank Tsinghua Publishing house for the "introduction of Swift Programming classic" translation work.

Spy on Swift programming and play on the playground

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.