Toybox 简化了 Xcode Playgrounds 的管理。
您可以通过 CLI 创建和打开 Xcode Playground。
$ toybox create Snippet
# Generate ~/.toybox/Snippet.playground and open with Xcode
本产品仍在开发中,界面可能会发生变化。
Toybox 需要 High Sierra 或更高版本。
$ brew tap giginet/toybox https://github.com/giginet/Toybox.git
$ brew install giginet/toybox/toybox
$ toybox version
如果在 tapping formula 时出现错误,请先尝试 brew untap giginet/toybox
。
安装 yonaskolb/Mint。
$ mint install giginet/toybox
# Create 'UIKitDemo.playground' for iOS
$ toybox create UIKitDemo
# Create a new Playground which is not saved
$ toybox create
# Create a new auto generated named Playground which is saved like 20190404082446.playground
$ toybox create -s
# Create 'SpriteKit.playground' for macOS
$ toybox create SpriteKitDemo --platform macos
# Overwrite existing playground 'UIKitDemo'
$ toybox create UIKitDemo -f
# Create but don't open with Xcode
$ toybox create UIKitDemo --no-open
# Create and open with specific Xcode
$ toybox create UIKitDemo --xcode-path /Application/Xcode7.3.app
$ toybox create UIKitDemo --xcode-version 11.1
# Create Playground from standard input
$ echo 'print("Hello World")' | toybox create --input
创建的 Playgrounds 将保存在 $HOME/.toybox
目录下
# List all existing playgrounds
$ toybox list
# List all playgrounds of specific platform
$ toybox list --platform ios
# Open UIKitDemo.playground with default Xcode
$ toybox open UIKitDemo
# Open UIKitDemo.playground with specific Xcode
$ toybox open UIKitDemo --xcode-path /Application/Xcode7.3.app
$ toybox open UIKitDemo --xcode-version 11.1
# Display current Toybox version
$ toybox version
# Display path to Toybox root directory,
# It should return '$HOME/.toybox'
$ toybox root
通过 peco 打开现有 playgrouds
toybox list | peco | awk '{print $1}' | xargs toybox open
直接使用 Xcode 11 打开 Toybox
目录。
$ swift package generate-xcodeproj
$ open Toybox.xcodeproj
giginet <giginet.net@gmail.com>
MIT 许可证