Easily generate Swift Playgrounds from your command line
for the new Playgrounds App on macOS π¨βπ»
- Easily generate and instantly open Swift Playgrounds
- Generate Playground with SwiftUI template
- Open code from GitHub in a Swift Playground
Before installing the SwiftPlaygroundsCLI please make sure you have downloaded the
Playgrounds.app
from the Mac App Store.
Mint is a package manager that installs and runs Swift command line tool packages.
$ mint install SvenTiigi/SwiftPlaygroundsCLI
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
To generate a new Swift Playground simply run:
$ swiftplayground new
If you wish to specify a name for the Playground run:
$ swiftplayground new MyAwesomePlayground
Generate a Playground from your clipboard content via:
$ swiftplayground new --clipboard
To generate a Playground with a SwiftUI template run:
$ swiftplayground new --view
A Playground with contents from a GitHub URL can be generated via:
$ swiftplayground new --url https://gist.github.com/SvenTiigi/7eae5e55edd9be41211470fcbd937285
A list of the available arguments that are supported by the SwiftPlaygroundsCLI.
Long parameter | Short parameter | Description |
---|---|---|
--clipboard |
-c |
Generate a Playground from the current Clipboard content |
--silent |
-s |
Generate a Playground without opening the Playgrounds application |
--url |
-u |
Generate a Playground with contents from a URL |
--view |
-v |
Generate a Playground with a SwiftUI template |
Contributions are very welcome π π€
SwiftPlaygroundsCLI is inspired by Playground
from JohnSundell
SwiftPlaygroundsCLI
Copyright (c) 2020 Sven Tiigi <sven.tiigi@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.