Build a playground book from a template, and run it in Swift Playgrounds.
You use both a Mac running Xcode and an iPad to create a playground book. You download the Swift Playgrounds Author Template and open it in Xcode on a Mac. You then write pages for the book and package up all of its resources into a
.playgroundbook file that you share with an iPad.
Extract and Open the Template
The Swift Playgrounds Author Template is packaged as a
.xip archive. To open the template, navigate to it in Finder and double-click it to extract it into a folder called Swift_Playgrounds_Author_Template_for_Xcode. Navigate within that folder to the Template subfolder and open the Xcode project named PlaygroundBook.
Build the Playground Book
The template contains all the initial files and resources you need to start writing content for Swift Playgrounds. Choose
Product > Build to compile these resources into a
.playgroundbook file that you can share with an iPad.
Run the Playground Book on Your iPad
To run the built playground book, transfer it to Swift Playgrounds:
Open Finder and select AirDrop.
In the project navigator for the template in Xcode, open the Products folder.
.playgroundbookfile over Finder and drop it on the icon representing your iPad.
Swift Playgrounds automatically opens when you share a playground book.
The following image shows the content from the template running in Swift Playgrounds.