Swift Playgrounds vs Xcode Playgrounds


« Updating A Swift Kickstart

Swift Kickstart Updated »

I didn't get far into revising my book before hitting a bump in the road: Swift Playgrounds are not the same on a Mac as they are on an iPad.

One of the biggest differences between Swift Playgrounds and Xcode Playgrounds is that Swift Playgrounds are much less powerful and are built more as an educational tool.

My biggest fear is that as Apple brings Swift Playgrounds to the Mac that they will stop supporting and growing Xcode Playgrounds.

Unfortunately the tools have the same name but they are vastly different.

I love Xcode playgrounds as a teaching tool.

They are very powerful and allow experimentation and quick feedback. It's the same thing I love about teaching SwiftUI as opposed to UIKit. With Xcode Playgrounds and SwiftUI together you get a very powerful environment for playing that naturally transitions into developing real projects.

One of the keys with this transition is that real projects have multiple files in different locations. We can do that with Xcode Playgrounds. I can give you a bunch of files and we can focus on the work at hand and then I can direct you to look at and modify another file.

So why did we need Swift Playgrounds?

First and foremost, Xcode playgrounds don't run on an iPad.

Swift Playgrounds allow us to bring coding tasks to people who either don't own a Mac or who prefer to work on an iPad or who are in a classroom setting where there are iPads available for student use.

Swift Playgrounds are also an excellent tool with some limitations:

All that aside, Swift Playgrounds are an excellent tool.

One limitation, however, is that it is impossible to edit those files in different locations.

On the iPad you can view these Auxiliary Source Files but you can't edit them. (although navigating these files is instructive - they are not presented in alphabetical order so numbering files "Page1", "Page2", ... or "Chapter1", "Chapter2", surprisingly doesn't mean that they will appear in any order that is meaningful or consistent to the user).

This, and the lack of a Console in Swift Playgrounds led me to revise my book when I decided to support Swift Playgrounds. It changed quite a bit of the book but I actually think this restriction changed the book in a positive way.

In the last year, Swift Playgrounds has come to the Mac.

So I was updating my book and taking new screenshots in Big Sur when I got to the paragraph that tells the reader to tap the three dots in the upper right corner to view the Auxiliary Source Files.

There were no three dots in the Mac version of Swift Playgrounds.

I looked through the rest of the interface, read the docs, and contacted a friend who would know and there isn't a way of viewing the files using Swift Playgrounds. There are hacks and workarounds but I want my three dots.

I'd like to be able to let students progress to the point where they can view and edit these files.

I love Xcode Playgrounds.

I like Swift Playgrounds. I'm hoping they become more powerful so that they can act as a tool for authoring, sharing, and experimenting with content and coding and transition nicely into full development.

BTW, the Radar is FB8557223.