
Use and create playground books in Swift Playground on Mac
In addition to working with app playgrounds, you can use and create playground books in Swift Playground. To view sample playground books, go to the More Playgrounds window—the sample playground books are in the Books section at the bottom.

Use a playground book
In the Swift Playground app
on your Mac, click Learn to Code, then click a playground in the Books section at the bottom of the More Playgrounds window to view a description.
If you’re working in a playground, choose Window > Welcome to Swift Playground, then click Learn to Code.
Click
to return to the More Playgrounds window, then click Get to download the playground book.
After it’s downloaded, double-click the playground book to open it.
If there’s code in the playground book, you can click Run My Code to see what it does.
To step through the code and see it become highlighted as it runs, click
, then choose Step Through My Code.
Create a new playground book
To create a new playground book, choose File > New Book. This creates and opens a blank playground book (named My Playground), which appears in the the sidebar of the Swift Playground welcome window.
When you’re ready to add your own code, see Enter code in a playground book. You can apply what you learned in the Learn to Code playgrounds and other playgrounds where you tried running code.