Xcode Playground Part III: Behind the Scenes

The Xcode Playground is an interactive REPL (Read-Eval-Print-Loop).

While you’re editing the code, Xcode executes, interprets and displays the results in the different views (timeline, result and console).

You can use the Swift interpreter from the command line:

There are also online interpreters like SwiftStub.com.

All-in-all the Playground coding experience is extremely interactive and feels like magic.
But this comes at the cost of performance. Complex or computing-intensive scripts run laggy. Even in the current XCode 7.1 release I regularly encounter errors that require an XCode restart.

But that’s okay!

For learning & testing this is acceptable and in many cases a better choice then a usual test project. I use it also for SpritKit test’s wich I demo in the next and last Episode of the XCode Playground series.

Links
Introduction to the Swift(Apple)
SwiftStub.com (online Swift Interpreter)