Chapter    2

The Swift Playground in Xcode

The Swift playground is a new environment where the developers can view and manipulate their code live, instead of having to compile and run and test their code. You type your code and the compiler evaluates the code and gives you feedback right away; you can see the side effects. Think of it as a mini project with one file and an SDK to compile against.

Note  Other languages such as Scheme or Lisp have what is called REPL (read-eval-print-loop), which serves the same purpose.

This chapter will walk you through creating a playground and interacting with it. You will also create your first basic programs in Swift. We will be using playgrounds throughout this book whenever we need to demonstrate some ...

Get Learn Swift 2 on the Mac, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.