http://blog.csdn.net/powerlly/article/details/29674253
Swift Development Learning: Playground
About
For software users, gamers, people have been advocating the user experience. In fact, the software developers themselves are users, is the user of various development tools, will also like the user experience to do a good tool software. This time, Apple wants developers to think of a playground--playground that can be played with Swift, which provides a convenient and fun development.
Please keep this link for the original power reprint.
What can playground do?
- Quick Practice Swift
Do not need to compile, do not need to click to execute, write code directly see the effect
Is it easier than scripting language?
Developers can quickly get grammar experiments, API calls, and so on through Playgroud.
Swift Tour Code GIT: Swifttour.playground
- Visual program Logic
Playground not only provides static variables for immediate viewing, but also shows values that change over time.
, with the two buttons in the upper right corner, you can switch between two edits of playground to try to
- Standard Editor instantly displays variable values
- Assistant Editor to display variable values on the timeline, or to customize the display
Assistant mode is important for developers to verify program logic:
- No longer need to step through breakpoint debugging
- Output log check is no longer required
- Not only can the numerical curve be displayed, but also the graphic image can be displayed
- Custom display
Developers can expand the dynamic display interface as needed to display the program in their own way.
As shown on the WWDC2014:
Playgroundiconview code GIT: Playgroundiconview.playground
What are the shortcomings of playground
- Playground temporarily does not support interface interaction
You can't play the game you developed in playground.
- Playground not emulator cannot execute app
Last question
Read the last Article Swift Development Study (a): the students in the initial chapter may still be thinking about my question.
As you may have learned from this article: Playground provides the ability to display results instantly, and is a development aid. But how to make playground in the development of debugging programs directly applied to the project, copy the code or other better way?
Question: So far I've been learning a little bit and haven't learned how to "include" another Swift in Main.swift. Who can tell me?
If this is solved, Playgroud can be reused once, there is a picture of the truth:
You know!
Please keep this link for the original power reprint.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Swift Development Learning (ii): Playground