Terminal Snippets for iOS Development
Remember to replace the following:
* {USER_NAME}
with your system username
* {API_KEY}
with your TestFlight API key.
* {TEAM_KEY}
with your TestFlight Team API Key.
# ---------------------------------
# xcode functions
# ---------------------------------
function xcclean() {
# Cleans the project via xctool CLI for workspace [$1] and scheme [$2] respectively.
if [ -z "$2" ]
then
echo "Workspace: \"$1\"."
xctool -workspace "$1.xcworkspace" -scheme "$1" -sdk iphonesimulator clean
else
echo "Workspace: \"$1\". Scheme: \"$2\"."
xctool -workspace "$1.xcworkspace" -scheme "$2" -sdk iphonesimulator clean
fi
}
function xcbuild() {
# Builds project via xctool CLI for workspace [$1] and scheme [$2] respectively.
if [ -z "$2" ]
then
echo "Workspace: \"$1\"."
xctool -workspace "$1.xcworkspace" -scheme "$1" -sdk iphonesimulator build
else
echo "Workspace: \"$1\". Scheme: \"$2\"."
xctool -workspace "$1.xcworkspace" -scheme "$2" -sdk iphonesimulator build
fi
}
function xctest() {
# Runs unit tests via xctool CLI for workspace [$1] and scheme [$2] respectively.
if [ -z "$2" ]
then
echo "Workspace: \"$1\"."
xctool -workspace "$1.xcworkspace" -scheme "$1" -sdk iphonesimulator test -parallelize
else
echo "Workspace: \"$1\". Scheme: \"$2\"."
xctool -workspace "$1.xcworkspace" -scheme "$2" -sdk iphonesimulator test -parallelize
fi
}
function xcbuildtests() {
# Build tests without re-building the project (good for testing SDKs) via xctool CLI for workspace [$1] and scheme [$2] respectively.
if [ -z "$2" ]
then
echo "Workspace: \"$1\"."
xctool -workspace "$1.xcworkspace" -scheme "$1" -sdk iphonesimulator build-tests
else
echo "Workspace: \"$1\". Scheme: \"$2\"."
xctool -workspace "$1.xcworkspace" -scheme "$2" -sdk iphonesimulator build-tests
fi
}
function xcruntests() {
# Runs tests from build-test command (good for testing SDKs) via xctool CLI for workspace [$1] and scheme [$2] respectively.
if [ -z "$2" ]
then
echo "Workspace: \"$1\"."
xctool -workspace "$1.xcworkspace" -scheme "$1" -sdk iphonesimulator run-tests -parallelize
else
echo "Workspace: \"$1\". Scheme: \"$2\"."
xctool -workspace "$1.xcworkspace" -scheme "$2" -sdk iphonesimulator run-tests -parallelize
fi
}
function xcall() {
# Cleans and builds project, then runs test via xctool CLI for workspace [$1] and scheme [$2] respectively.
if [ -z "$2" ]
then
echo "Workspace: \"$1\"."
xctool -workspace "$1.xcworkspace" -scheme "$1" -sdk iphonesimulator clean build test -parallelize
else
echo "Workspace: \"$1\". Scheme: \"$2\"."
xctool -workspace "$1.xcworkspace" -scheme "$2" -sdk iphonesimulator clean build test -parallelize
fi
}
# ---------------------------------
# testflight aliases
# ---------------------------------
alias xcipa='ipa build && ipa distribute:testflight -a {API_KEY} -T {TEAM_KEY}'
# ---------------------------------
# iphone simulator functions
# ---------------------------------
function oips() {
# Opens iPhone Simulator directory for SDK [$1] and architecture [$2] respectively.
if [ -z "$2" ]
then
echo "iPhone Simulator $1 32-bit."
/Users/{USER_NAME}/Library/Application\ Support/iPhone\ Simulator/$1/Applications
else
echo "iPhone Simulator $1 $2-bit."
/Users/{USER_NAME}/Library/Application\ Support/iPhone\ Simulator/$1-$2/Applications
fi
}
Written by Paris Xavier Pinkney
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#