Book Image

Swift Essentials - Second Edition

By : Alex Blewitt
Book Image

Swift Essentials - Second Edition

By: Alex Blewitt

Overview of this book

Swift was considered one of the biggest innovations last year, and certainly with Swift 2 announced at WWDC in 2015, this segment of the developer space will continue to be hot and dominating. This is a fast-paced guide to provide an overview of Swift programming and then walks you through in detail how to write iOS applications. Progress through chapters on custom views, networking, parsing and build a complete application as a Git repository, all by using Swift as the core language
Table of Contents (17 chapters)
Swift Essentials Second Edition
About the Author
About the Reviewer

Chapter 2. Playing with Swift

Xcode ships with both a command-line interpreter (which was covered in Chapter 1, Exploring Swift) and a graphical interface called playground that can be used to prototype and test Swift code snippets. Code that is 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's live documentation

  • Creating multiple pages in a playground

  • Limitations of playgrounds