SwiftPlaygroundsCLI

Easily generate Swift Playgrounds from your command line
for the new Playgrounds App on macOS.

Demo

Features

  • [x] Easily generate and instantly open Swift Playgrounds
  • [x] Generate Playground with SwiftUI template
  • [x] Open code from GitHub in a Swift Playground

Installation

Mint 🌱

Mint is a package manager that installs and runs Swift command line tool packages.

$ mint install SvenTiigi/SwiftPlaygroundsCLI

Homebrew 🍺

Homebrew is a free and open-source software package management system that simplifies the installation of software on Apple's macOS operating system.

$ brew tap SvenTiigi/SwiftPlaygroundsCLI
$ brew install swiftplaygroundscli

Usage 👨‍💻

To generate a new Swift Playground simply run:

$ swiftplayground new

If you wish to specify a name for the Playground run:

$ swiftplayground new MyAwesomePlayground

To generate a Playground with a SwiftUI template run:

$ swiftplayground new --view

ViewOptionDemo

A Playground with contents from a GitHub URL can be generated via:

$ swiftplayground new --url https://gist.github.com/SvenTiigi/7eae5e55edd9be41211470fcbd937285

RemoteOptionDemo

Arguments

A list of the available arguments that are supported by the SwiftPlaygroundsCLI.

Long parameter Short parameter Description
--view -v Generate a Playground with a SwiftUI template
--url -u Generate a Playground with contents from a URL
--silent -s Generate a Playground without opening the Playgrounds application

GitHub