Swift 5, Xcode 11, Catalina
Swift Playgrounds can now run on either iPad or macOS (10.15.3 or newer).
Related: Swift Playgrounds Release Notes
Caveat: However, the most-recently available "Swift Playgrounds Author Template for Xcode 11.1 (for Swift Playground 3.3)" does not build "as-is" with the current Xcode 11.4.1 release.
Xcode 8
Creating and Running a Playground Book indicates that…
You use both a Mac running Xcode and an iPad to create a playground book.
The only recommended (supported?) workflow for a *.playgroundbook
appears to be "edit in Xcode, run on iPad" with Starter.playgroundbook provided as a starting point.
The suggested workflow is:
- Make targeted changes to the book’s content and structure in Xcode
- Transfer the updated book into Swift Playgrounds using iCloud or AirDrop
- Open the updated book and test the changes
- Note any additional changes that are needed, and return to step 1
Note that an iPad Playgrounds +
➜ New Playground
➜ Blank
creates a non-book *.playground
that can be run both on iPad and in Xcode.
Pages can be added although *.playground
is not a *.playgroundbook
.
Note: iPad currently uses a newer version of contents.xcplayground
than Xcode 9, so CREATE a blank *.playground
and ADD new *.playground
pages on the iPad to be seen in both iPad or Xcode.
contents.xcplayground
<playground version='6.0' target-platform='ios'>
<pages>
<page name='Page One'/>
<page name='Page Two'/>
</pages>
</playground>