If you’re going through the Apple iBook on Swift, you’ll see pretty early on that the book gives this note:
For the best experience, open this chapter as a playground in Xcode. Playgrounds allow you to edit the code listings and see the result immediately.
But it doesn’t tell you how to do this.
The only way to open the chapter as a playground in Xcode as far as I know is to open the web version of The Swift Programming Language book.
There is an “Open Playground” link in the web version of the book that will download a zip file that contains a Playground for the chapter.