Skip to content

Instantly share code, notes, and snippets.

@kinwahlai
Last active September 12, 2024 05:30
Show Gist options
  • Save kinwahlai/a31b236478c585194017a89a0c49e576 to your computer and use it in GitHub Desktop.
Save kinwahlai/a31b236478c585194017a89a0c49e576 to your computer and use it in GitHub Desktop.
Disable swipe tutorial for simulator (ios13 above)
#!/bin/bash
# This script archive 2 things here
# 1. boot the fresh simulator once, so we can reduce the boot time in UI test
# 2. Simulator shows swipe tutorial on first use of keyboard (iOS13 above), this script will set simulator preferences so it wont show the tutorial
function get_simulator_udid() {
echo '' | xcrun simctl list devices | grep "iPhone" | grep -v "unavailable" | awk -F "[()]" '{ for (i=2; i<NF; i+=2) print $i }' | grep '^[-A-Z0-9]*$'
}
(
simulators=$(get_simulator_udid)
while IFS=' ' read -ra simulator; do
for uuid in "${simulator[@]}"; do
echo "Boot $uuid"
xcrun simctl boot $uuid 2>> /dev/null 1>>/dev/null
echo "Update simulator preferences $uuid"
# set preferences to skip showing the swipe tutorial
xcrun simctl spawn $uuid defaults write com.apple.Preferences DidShowContinuousPathIntroduction 1
echo "shutdown $uuid"
xcrun simctl shutdown $uuid
done
done <<< "$simulators"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment