Is it possible to add package dependencies to a playground in Swift Playgrounds?

Swift Playgrounds supports two kinds of projects: playgrounds and app playgrounds. This article explains how to add a package dependency to an app playground. Is there a way to add package dependencies to a regular (non-app) playground?

More generally, I’m looking for a simpler way to run a Swift script that depends on an external package I’ve written than:

  1. Running swift package init --type executable
  2. Manually adding the necessary lines to Package.swift.

Because I’m teaching Swift to novice programmers, and I fear that the above would be too many hoops. Swift Playgrounds would be a good pedagogical fit, but I’m open to alternative solutions.

Have you tried Arena?


Hadn’t heard of it; thanks for the tip! It does look like Arena will solve the problem. I’ll check it out.

1 Like