Skip to content

Instantly share code, notes, and snippets.

@yas375
Last active June 7, 2016 22:29
Show Gist options
  • Save yas375/f78a227c12a1a27a6d2f9dc7d19fb247 to your computer and use it in GitHub Desktop.
Save yas375/f78a227c12a1a27a6d2f9dc7d19fb247 to your computer and use it in GitHub Desktop.
Annoyed by Xcode asking a name for each playground you create? Me too! Most often I use playgrounds I just want to try out something real quick.
  1. Create a playground from xcode which you are going to use as a template. Call it Template.playground or modify the script.
  2. Put the script into the same directory.
  3. chmod +x justplay. You can run the script from terminal. I decided to add it as a behavior to Xcode and to use default shortcut to run it.
  4. In Xcode go to Xcode->Behaviors->Edit behaviors
  5. Add a new behavior
  6. Choose the justplay script to run for that behavior.
  7. Assign a shortcut to it. I use a default shortcut for creating a playground: ⌥⇧⌘N
#!/bin/bash
set -e
TEMPLATE_NAME="Template.playground"
DESTINATION_PATH=`mktemp -d`/$TEMPLATE_NAME
cp -R "`dirname $0`/$TEMPLATE_NAME" $DESTINATION_PATH
open $DESTINATION_PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment