Chapter 2. Playing with Swift
Xcode ships with both a command line interpreter (covered in Chapter 1, Exploring Swift) and a graphical interface called playground that can be used to prototype and test Swift code snippets. Code typed into the playground is compiled and executed interactively, which permits a fluid style of development. In addition, the user interface can present a graphical view of variables as well as a timeline, which can show how loops are executed. Finally, playgrounds can mix and match code and documentation, leading to the possibility of providing example code as playgrounds and using playgrounds to learn how to use existing APIs and frameworks.
This chapter will present the following topics:
- How to create a playground
- Displaying values in the timeline
- Presenting objects with Quick Look
- Running asynchronous code
- Using playground live documentation
- Generating playgrounds with Markdown and AsciiDoc
- Limitations of playgrounds