Experiments with JavaScript in Swift Playgrounds

In preparation for the SIGCSE 2015 I put together a demo showing ways to leverage Swift’s Playgrounds for a more immersive learning experience. They are:



The first example is an introduction to Swift Playgrounds. It gives a quick overview of the element of the Playground environment itself (the Results Sidebar, Assistant Editor, etc.). It concludes with some JavaScript multiple-choice self-test questions.

The second example introduces while-loops and the Assistant Editor. It also contains a “code building” component that uses a “Parsons problem” from Runestone Interactive. The Parson’s Problems are a powerful way to guide learners to proper logic and syntax. Rather than create code from scratch, it’s just a matter of dragging/dropping code in the correct order, as seen here:
In the full while-loop playground example the learner should also type in the actual code and evaluate it in the playground.


  • Both examples were built with Jason Sandmeyer’s Playground builder (https://github.com/jas/playground).
  • The quizzes and Parsons problem use JavaScript and CSS from

Including interactive JavaScript in Playgrounds could be a great tool for improving their impact, but it requires some effort to set it up.