Book Image

Swift Essentials

By : Alex Blewitt, Bandlem Limited
Book Image

Swift Essentials

By: Alex Blewitt, Bandlem Limited

Overview of this book

Whether you are a seasoned Objective-C developer or new to the Xcode platform, Swift Essentials will provide you with all you need to know to get started with the language. Prior experience with iOS development is not necessary, but will be helpful to get the most out of the book.
Table of Contents (10 chapters)
9
Index

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